in reply to Re: Perl 6 and performance
in thread Perl 6 and performance
Thank you for the detailed answer. It indeed makes the cause of the problem clear.
For me, it's more natural to write a floating point constant one as 1.0, however, that doesn't work. And this won't even run:
time ./perl6 -e 'my $s; for 1..10000 {$s+=1./$_**2};say $s' ===SORRY!=== Unable to parse blockoid, couldn't find final '}' at line 2
I've also tried to explicitly declare the loop variable as a floating point:
./perl6 -e 'my $s;my Num $i;for 1..10000 -> $i {$s+=1/$i**2};say $s'
This has no effect, as can be seen from the following:
./perl6 -e 'my Num $s;my Num $i;for 1..10000 -> $i {$s+=1/$i**2};say $ +s' Type check failed in assignment to '$s'; expected 'Num' but got 'Rat' in method reify at src/gen/CORE.setting:4471 in method reify at src/gen/CORE.setting:4376 in method reify at src/gen/CORE.setting:4376 in method gimme at src/gen/CORE.setting:4740 in method eager at src/gen/CORE.setting:4715 in method eager at src/gen/CORE.setting:1028 in sub eager at src/gen/CORE.setting:5000
Does this mean that even though I declare $i as a Num, it's still an integer when used as a loop variable? Is it because the .. operator supplies integers?
P.S. I'm sad to see that perlmonks is slowly becoming more like reddit, where problems are met with rancorousness instead of being discussed on a technical level.
I admit that I posed the original question in a slightly more trollish way than necessary, and I apologize for the inconvenience I might have created. I didn't intend to denigrate the effort of the Perl 6 developers - an effort which is nothing short of heroic.
However, I do think that the problems with the current state of Perl 6 go way beyond the technical level, and pretending that these problems can be treated at the mere technical level is an attitude that does more harm than good on the long term.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Perl 6 and performance
by moritz (Cardinal) on Feb 09, 2012 at 19:59 UTC | |
by kikuchiyo (Hermit) on Feb 09, 2012 at 21:00 UTC | |
by moritz (Cardinal) on Feb 10, 2012 at 05:52 UTC |