Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: What's wrong with Perl 6?

by TimToady (Parson)
on May 10, 2007 at 23:49 UTC ( [id://614781]=note: print w/replies, xml ) Need Help??


in reply to Re: What's wrong with Perl 6?
in thread What's wrong with Perl 6?

Yes, it's easy to have a great deal of affection for the current syntax. It seemed like a good idea at the time, and still works pretty well in the context of the rest of Perl 5. But to some extent you have to take it on faith that we didn't change anything without at least the semblance of a good reason, and many of these reasons make more sense in the context of Perl 6 as a whole. I can attempt to explain some of those decisions here, but I can't rejustify every decision, or I'd end up copying all the Apocalypses, Exegeses, Synopses into Perl Monks, not to mention replicating a great number of design meetings, phone logs, irc chats, etc. And as chromatic points out, we'd never get any work done if we tried to answer every question multiple times.

However, I have some hope that this thread will have sufficient cultural leverage to make a difference, so I'm responding here. On your particular points:

for =$fh - that just looks string. I think while(<$fh>) is too strong of idiom to break
Brackets are in extremely short supply in ASCII, and the angle brackets were rather wasted on a single operator. Plus we really needed to do something about the strange autoquoting rules in subscripts that result in far too many FAQs. Stealing angles for both qw// and literal subscripts solved those problems, but it meant that we needed something else to iterate iterators. And unary = is the best we've come up with so far, given all the other demands on the character set. It has some visual mnemonic value in that it looks kinda like two lines from a file. But yes, it's a little strange.
~ ~ for string concats
We needed something for that operator, and dot was no longer going to be available. We can't use juxtaposition like awk because that screws up expectations of terms vs operators, a fundamental contextual idea that carries through all the way from Perl 1 to Perl 6. We originally specced _ for it, but it didn't work well next to identifiers, and we wanted to reserve the underscore identifier for other potential uses, so we settled on ~ because it looks like a bit of string, and because the bitwise uses of tilde were going away in favor of a de-Huffmanized but more regular set of bit operators, so tilde was available.
??!! replacing ? :
This is another case where some very important keys on the keyboard are locked up in not-so-very important operator, so we decided to de-Huffmanize and rationalize them. (The use of a bare colon was particularly difficult because there were so many other proposed uses for colon that we were trying to accomodate.)

The character doubling fits in culturally with the other short-circuiting forms such as && and ||. At one point the else was indicated by a double colon, but that turned out to be visually ambiguous with package name delimiters, plus we have a fairly consistent usage of ? to mean true and ! to mean false through the rest of the language.

Anyway, you undoubtedly like the current Perl 5 idioms for the same reasons that I liked them originally. :-) I would like to believe that you'll end up liking the Perl 6 idioms too, once you get used to them.

Replies are listed 'Best First'.
Re^3: What's wrong with Perl 6?
by nferraz (Monk) on May 14, 2007 at 09:56 UTC

    Stealing angles for both qw// and literal subscripts solved those problems, but it meant that we needed something else to iterate iterators. And unary = is the best we've come up with so far, given all the other demands on the character set. It has some visual mnemonic value in that it looks kinda like two lines from a file. But yes, it's a little strange.

    Reusing angle brackets was a great idea. I really like being able to write stuff like:

    my @array = < foo bar baz >; # instead of qw/ foo bar baz / %hash<foo>; # instead of %hash{'foo'}

    But I also agree that the unary = is a bit strange.

    (On the other hand, qw// was a *very* strange idiom -- so I believe that, overall, Perl6 is a bit less strange beast.)

Re^3: What's wrong with Perl 6?
by blazar (Canon) on May 14, 2007 at 21:18 UTC
    ??!! replacing ? :

    I know this is completely OT in the context of this thread, but I've not been in p6l for a long time and I'm trying my hand here. Now, I've sometimes felt the need to distinguish in a single statement between "TRUE", "FALSE" and "UNDEFINED". To this effect in Perl 5 I've had to use nested ?:'s or other short circuiting operators, with an overall "too much effort" back taste. I was wondering if by any chance Perl 6 could incorporate unambiguously in ??!! an optional additional !! so that the fourth argument is returned in case the condition turns out to be undefined.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://614781]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2024-04-23 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found