> -----Original Message-----
> From: Adam Turoff [mailto:[EMAIL PROTECTED]
> On Tue, Nov 25, 2003 at 01:03:19PM +1100, Damian Conway wrote:
> > Schwern observed:

> > Perhaps this is yet another argument for insisting on:
> >
> >     while do {$n++; $foo > $bar}
> >
> > instead.
>
> That looks like syntactic sugar for
>
>       while (do) {$n++; $foo > $bar}
>
> and could be interpreted as either:
>
>       while "do" {...}  ## perl5 bareword
>       while do() {...}
>
> Luke's "then" feels like the best fit on the one hand, and the worst fit
> on the other.  Everything else feels worse, though.

Hmm. Why not just explicitly allow semicolon when surrounded by parens?

  while ($n++; $foo > $bar) {...}

Removing the parens changes the results, which is just what you'd expect
mathematically.

  $f = (0, 1, 2, $n++, $foo > $bar);    # List

  $f = (0; 1; 2; $n++; $foo > $bar);    # Sequence of statements, three
useless.

"C" style C<for> loops then look like:

  for (($a = 0; $b = $num_elts); $a < @arry; ($a++; $b -= $offset)) {...}

Which is on the one hand yucky, but on the other hand very explicit.

(I suppose I could propose using semicolon for the list separator, but that
would drive the syntax-highlighters insane, and I like syntax-highlighting.)

=Austin

PS: An immediate drawback that occurs to me is that of catching unbalanced
parens -- when the statement terminator is a valid sequence delimiter, all
the rest of the code looks like a sequence. But the first nesting closing
brace would probably catch that.

Reply via email to