by strick

Is Larry Wall on crack?

Let's hope so -- otherwise what would justify stuff like the proposed perl6 Insignificant[sic] Whitespace Hack, beginning in about the 9th paragraph of http://www.perl.com/pub/a/2002/01/15/apo4.html?page=2.

When I first started reading about perl6, I thought great, they're fixing a lot of the things I complain about in my essay Everything In Perl Is Wrong.

But now that I realize perl6 will still be intentionally ambiguous -- with heuristics based on what kind of white space you use (spaces or newlines?) -- I give up on any hope for perl6.

Perl is a "semicolon language", like C & C++ & Java. You have to use semicolons to terminate statements, and so whitespace doesn't matter (newlines are just whitespace, like spaces). There exist -- and personally, I like -- no-semicolon languages, like Awk, Tcl, & Python, which can always use newlines to terminate statements. But adding a single newline hack to an otherwise semicolon language is just Wrong!


So what is this hack about?

Here's an excerpt from the Apocalypse linked above:

In Perl, this problem comes up most often when people say "Why do I have to put a semicolon after do {} or eval {} when it looks like a complete statement?" Well, in Perl 6, you don't, if the final curly is on a line by itself. That is, if you use an expression block as if it were a statement block, it behaves as one. The win is that these rules are consistent across all expression blocks, whether user-defined or built-in. Any expression block construct can be treated as either a statement or a component of an expression. Here's a block that is being treated as a term in an expression:
    $x = do {
        ...
    } + 1;
However, if you write
    $x = do {
        ...
    }
    + 1;
then the + will be taken erroneously as the start of a new statement. (So don't do that.)

 


 
Read more of   The Yak's Frequently Questioned Answers   (mod.2008-06-12)

432.   Who are the Steve Police?   [jake/2006-05-21]
429.   why does my 802.11g network seem to die around Uniden 2.4ghz phones?   [jake/2006-05-19]
425.   How do I make a FireFox search plugin?   [gregr/2005-05-17]
424.   Where do you get StrickPants?   [strick/2007-06-30]
414.   What is art?   [jake/2004-09-22]
403.   What is warviewing / warspying?   [jake/2004-01-28]
386.   What is Trinux ?   [brad/2003-10-06]
375.   What are two indispensable websites for traveling Europe?   [jake/2003-09-22]
372.   What is the offical 'insta-gay' drink™ of #temp?   [ross/2003-09-16]
333.   what is the orgin of the word family?   [jesse/2002-10-25]
238.   How does John Horton Conway figure out what day of the week it is?   [strick/2001-06-04] ( rupe/2001-06-05 )
229.   How do I convert a conventional laser pointer to a modulated laser?   [rupe/2001-05-29]
195.   why wont my computer boot off of its hard drive?   [jesse/2001-03-11] ( strick/2001-03-12 )
160.   Where can I find information about Dr. Bronner?   [rupe/2001-01-04] ( strick/2001-01-07 )
112.   Where can I find information on older SGI systems?   [rupe/2000-07-09]
110.   How can I download a new ringtone to my SMS capable phone without having net access?   [rupe/2000-07-09]
86.   How do those little Anti-Shoplifting tags work?   [strick/2000-05-02]