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.2010-02-10)

430.   How can I migrate my encrypted gpassman files to ascii?   [jake/2006-05-20]
425.   How do I make a FireFox search plugin?   [gregr/2005-05-17]
420.   How can I use a new 40 Gig iPod with Debian and USB   [jake/2005-03-01]
375.   What are two indispensable websites for traveling Europe?   [jake/2003-09-22]
366.   What is a really good german street map website?   [jake/2003-07-10]
353.   Can you show me something interesting with apt-cache and graphivz?   [jake/2003-03-01]
292.   what do you do when your favorite web site becomes no more?   [kurt/2001-11-29]
242.   What bugs exist in the Nokia 7190 firmware?   [rupe/2001-07-17]
191.   What did Jon Postel (IANA)'s obituary look like?   [rupe/2001-03-06] ( strick/2001-03-11 )
123.   How do I check for the existence of a file in Python?   [rupe/2000-09-25]
120.   What is the Hacker's Manifesto?   [rupe/2001-08-14]
107.   Where can I find out how to install and use the distributed rendering package PVMPOV?   [rupe/2000-07-04]
98.   What are the rules for SHOTGUN?   [strick/2000-05-18]
97.   Where can I find WAP/WML resources on the net?   [rupe/2000-06-06]
87.   How do i OPT OUT of doubleclick's user-tracking cookies?   [strick/2000-05-11]
75.   Where can I get an Isreali standard issue military gas mask for under $30.00 US?   [simon/2000-04-05]
62.   What is the diameter of the World Wide Web?   [jamison/2000-04-01]
52.   What countries are .HR .SR .TT .LK etc.   [strick/2000-02-07]
41.   Which OS Sucks? Which OS Rules?   [strick/2000-02-02]
29.   Where can I find out about the DVD hack?   [strick/2000-02-06]