5 ms·
I can't think of a single capitalized keyword. Unless you mean capitalized built-in classes, or the infix meta operators. Certain parts are faster than Perl 5
by b2gills 10y ago
I can't think of a single capitalized keyword.
Unless you mean capitalized built-in classes, or the infix meta operators.
Certain parts are faster than Perl 5, for example this finds the sum of a range in less than a millisecond. ( of course it cheats by calling the sum method on the Range object )
my $sum = [+] 1..100000000000000000000000;
That was the syntax for a left fold using the infix numeric addition operator. ( You can use just about any infix operator there and it will be a right fold if the operator says that is what it should do )
There are other places where if you write your code carefully knowing the ins and outs of the implementation, where Perl 6 is faster than you could get in Perl 5.
Then there is the fact that a lot of optimizations that are known about aren't being done, and a new JIT is in the works for MoarVM.
- vgy7ujm 10y agoPerhaps worth another look again. I remember 'Int', '.WHAT', etc. from some presentations and that stung in my eyes a bit.
- raiph 10y agoPerl 6 makes careful use of letter case to convey useful information. If it's in ALL CAPS then it's drawing some attention to the fact that something VERY UNUSUAL is going on. For example, `WHAT`, `HOW` etc. are special compiler macros, not at all ordinary routines. Fortunately there's little or no need to use these in typical Perl 6 programs. Another example are the "phasers" CATCH, LEAVE, UNDO, etc. These are unusual because they are executed according to execution phases rather than the sequential order of code. Another convention is use of initial caps. All built in object type names use initial caps. Hence `Int` for the arbitrary size integer type. (Use `int` for the native machine oriented alternative.) This all may sound weird but I find it works well for me in practice.
- vgy7ujm 10y agoI hope these things are explained well in the upcoming books. Me, a seasoned Perl 5 programmer that doesn't participate much in the Perl 6 community find these things a bit strange and visually a turnoff if you get what I mean. Also angle brackets usage no auto quoting was something I remember not liking too much. Note that this has more to do with familiarity and syntax than the new features etc. I very much hope for a "Java killer" in the Perl family but that means performance must be a first priority. Thanks for explaining, at least I can view examples with a little more understanding of the syntax choices going forward.