Re: Significant whitespace (was Re: Blogging sucks)

[prev] [thread] [next] [lurker] [Date index for 2005/10/16]

From: A. Pagaltzis
Subject: Re: Significant whitespace (was Re: Blogging sucks)
Date: 22:11 on 16 Oct 2005
* Abigail <abigail@xxxxxxx.xx> [2005-10-14 10:10]:
> Someone pointed out that I was incorrect. It turns out to be
> _worse_:
> 
>       my %hash;                        # Empty hash.
>       if %hash{1} {print "Found it"}   # No output.
>       if %hash {1} {print "Found it"}  # Syntax error.
>       if %hash {1}
>       {print "Found it"}               # Prints 'Found it'.

That’s really just obfuscation based on expectations from Perl5.
Once you know that there must be no whitespace between the hash
name and the key lookup operator in Perl6, the parsing is
completely straightforward.

Of course, you are free to dislike that syntax rule.

Can you throw in whitespace in those examples if you use the new
%hash«key» syntax instead?

(And if not, would it at least be possible to parse the examples
umambiguously if it *were* allowed? If the answer to that
question is yes, then I would lobby for dropping the {} hash
lookup operator altogether and permitting whitespace with the «»
operator.)

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>;
There's stuff above here

Generated at 20:00 on 17 Oct 2005 by mariachi 0.52