On Saturday 19 January 2002 12:24, Piers Cawley wrote:
> You're treating do, if, foreach as if they were keywords. I'm not
> entirely sure that that's still the case.
'do' perhaps. But not really. And it's irrelevant to my argument.
> And you're also forgetting
> the possibility of user implemented control type operators/methods.
No, I'm not. As a matter of fact, I had even wrote a section on
user-defined constructs, only to find that my arguments were exactly the
same, so I removed it as superfluous.
>
> Unless I'm very much mistaken you're suggesting that we special case
> the parser for 'do' and any user defined functions that take a block
> can go hang. Which I'm really not keen on.
Then you're very much mistaken. :-)
I'm saying that if you're going to DWIM an expression as a block, do it
based on the expression being used in the standard context of a block,
rather than the fact that the trailing '}' appears on a line by itself. In
other words, I'm very much for Larry's idea. Just put the burden on the
parser, rather than on the parser and the person.
That applies to *any* expressionish block - do, BEGIN, INIT, sub (sort of),
the old eval which is now gone, or a user-defined one. I simply picked on
do {} and BEGIN {} because they were the examples given in the Apocalypse.
--
Bryan C. Warnock
[EMAIL PROTECTED]