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-11-08)

443.   Who is Tila Tequila?   [n0b0dy/2008-06-12]
441.   What is Conware?   [jake/2006-12-22]
434.   How can I get around registering your real email with a given service? (or what's a good way to get a feed for a throwaway email?)   [jake/2006-06-02]
380.   What is a dirty hack to see some statistics on the FQAs posted here?   [jake/2003-09-22]
309.   What does the YAK do about SPAM?   [strick/2002-02-26]
264.   What started in 1984?   [strick/2001-08-10] ( macki/2001-09-04 robey/2001-08-22 )
232.   Where can i find a stamp sized ethernet web server for (barely)less than $100?   [sidd/2001-05-30]
187.   So when's the BIG PARTY?   [strick/2002-01-23] ( nana/2001-03-22 nana/2001-03-21 macki/2001-03-04 )
178.   Why isn't my PCS email working on my Cingular/PB Wireless phone?   [rupe/2001-02-12]
166.   Where can I find information on the current status of nuclear plants nationwide?   [rupe/2001-01-24]
112.   Where can I find information on older SGI systems?   [rupe/2000-07-09]
108.   How can i get custom ring tones onto my cell phone?   [jesse/2000-07-09]
82.   Can Mice Fly ?   [philbert2k/2000-04-27]
81.   How do I do port-forwarding with ssh?   [robey/2001-03-25]
57.   How do you make popcorn salad, and is it actually a "salad"?   [mockturtle/2000-02-12]
56.   Hows do i make bogus IDENTD   [ross/2000-02-11] ( jesse/2000-11-15 strick/2000-10-30 )
43.   How much coffee/Mountain Dew can you drink before dying?   [robey/2002-12-06]
37.   What is this "goo" that holds the yak together?   [robey/2000-02-01]
31.   Was Ross at Kevin Mitnick's release?   [strick/2000-01-23]