Thanks for this interesting and entertaining read (the same goes for the previous article about classes, only I got no useful comment on that)
You emphasize the shortness of perl compared even to lisp. This reminds me of apl which made shortness a design principle and as a consequence could be called the first true write-only language. Sometimes I think Perl6 might have too much of apls density and adas feature creep. But then I need to remind myself that perl (5 and 6) is not one but many languages because of TIMTOWTDI. This is one big feature and there is a price to pay
| [reply] |
| [reply] |
So the APL library on cpan6 is not far away and all those old financial programs not written in COBOL will be moved over from ancient mainframes to perl. Hooray ;-)
Terseness is not a problem in itself. No one likes to type 'System.out.println' instead of 'print' (one of the reasons I never got around programming in java).
The problems begin when the redundancy is so low and the feature density so high that you can replace or add one single punctuation character or even a space and the statement is with high probability still syntactically correct and does something totally different.
perl already has a reputation as a obfuscated language, this reputation might even get worse with perl6. I've gotten a lot better reading perl code since I've started posting here on perlmonks, but I still get the uneasy feeling occassionaly that the bug I identified in some users code might be valid syntax that I just forgot. Just a few days ago I saw that someone had typed =\ instead of =~ in his code. To my surprise the whole statement was still valid syntax but I couldn't say why at first. With the explosion of (syntactically) overloaded/reused punctuation characters in perl6 I fear I might get that surprise a lot more often
Don't get me wrong, I like perl6 and the freedom of picking all the bits I like out of the language will make me a happy coder. And my fears are probably based on ignorance and an overdose of apocalypses read a long time ago. But my impression was that perl6 syntax has twice or three times as many constructs/elements as perl5 and instead of using words to make those constructs easily distinguishable, another layer of meaning is heaped upon some punctuation character.
brackets have 4 uses in perl5 depending on context, caret three and colons two. In perl6 each has a lot more (if my impression is correct). Apart from the poor people who have to write the perl6 parser what about the humans who have to parse it?
| [reply] |
sub addn($n)
{
my $retsub = sub ($x) { $x + $n }
return $retsub;
}
So, in Perl 6, by the time it gets into the first set of curlies { my ... }, $n is already a copy of the argument passed in to addn() and not simply an alias?
No need to do the following?
sub addn($n)
{
my $m = $n;
my $retsub = sub ($x) { $x + $m }
return $retsub;
}
I'm curious. Thanks. | [reply] [d/l] [select] |
| [reply] |
Actually, you can't say $s += $^i for ^$n; because such implicit parameters are defined to scope to the nearest enclosing curlies, and the for modifier doesn't supply curlies. | [reply] [d/l] [select] |