On 4/16/02 10:22 AM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> claimed:
> Eh, no. You got it backwards. It's not that you need a space before
> a control block, it is that "If you put a space before a {, it *IS*
> a control block".
>
> It's the space that determines what follows is a control block.
You're right. Larry writes in Apo4:
Therefore, we will make the rule that a left curly that has whitespace
in front of it will never be interpreted as a subscript in Perl 6.
> It's not that it isn't necessary. It's forbidden. Unlike in C, awk,
> Java, Pascal, or even in the language of the whitespace, Python. Any
> language I can remember programming in in the last 2 decades allows
> optional whitespace between the aggregate and the index, without
> parsing things differently.
Yes, and Larry argues that this 99% of the time, people leave the whitespace
out of the aggregate and the index. This appears to me to be true, from the
code I have read and written.
> That's a syntax error. You've some stuff in void context, and then
> you're assigning something to a block.
Right. Next time I'll check the refs before I open my big gob.
> The problem is, because the ()'s are dropped, the parser cannot know
> where the control block starts, hence the new rule "any opening brace
> following whitespace will be a block".
Note, however, that you can still use the ()'s if you want, "just for old
times' sake."
> Having to *add* code isn't actually making a shortcut, is it? ;-)
For me, it makes it much more readable. If I start writing code with hashes
as long and ugly as the example originally reposted, it's time to start
refactoring. I'd probably look to turn such a complex beast into an object,
instead, and create accessors to simplify access.
Regards,
David
--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
http://david.wheeler.net/ Yahoo!: dew7e
Jabber: [EMAIL PROTECTED]