Jonathan Scott Duff wrote:
Let's set aside for the moment the fact that slurpy arrays/hashes aren't autothreaded and talk about a user-defined routine:
sub foo ($alpha) { ... }
It doesn't take much imagination to come up with a mechanism for Perl6 programmers to stop the autothreading:
sub foo is nonthreaded ($alpha) { ... }
Ironically, the way you do that in Perl 6 is with a junction:
sub foo ($alpha is none(Junction)) { ... }
which would cause an execption of some sort on attempted "junctification"
The down side is that programmers need to be more aware of subroutine/method side effects and write their programs accordingly.
This is a *down*-side??? ;-)
Because of this, I'd suggest that autothreading of user-defined routines not be the default, but rather enabled via a pragma of some sort (or, of course, via an "autothreaded" trait). For the built-in routines this isn't a worry as we get to design them appropriately.
This seems to be needlessly optimizing for the rare case. And needlessly restrictive.
I'd suggest that it would suffice to have a(n optional) warning emitted when a subroutine with side-effects is autothreaded:
use warnings 'autothreading';
Damian