----- Original Message -----
From: <[EMAIL PROTECTED]>
> On Fri, Apr 12, 2002 at 04:42:07PM +0100, Piers Cawley wrote:
> > [EMAIL PROTECTED] writes:
> > >
> > > Why isn't
> > >
> > >     if %foo {"key"} {print "Hello 1"}
> > >
> > > equivalent with the perl5 syntax:
> > >
> > >     if (%foo) {"key"} {print "Hello 1"}
> > >
> > > Which keyword is it expecting?
> >
> > Keyword /els(e|if)/, or end of line, or semicolon. Sorry badly phrased
> > on my part. The closing brace of {"key"} only ends the statement if it
> > is followed by /\s*$/, or a semicolon.
>
>
> You've got to be kidding. That makes the whitespace rules even more
> insane; your program can behave quite differently wether there's a space,
> a newline, or nothing between two tokens. Wonderful!  People who tend
> to use -e all the time (like me) will love it. (Not!) Pasting code into
> IRC will be so much more fun.

I don't think it's all that insane, Perl has history with implied
semicolons.

Perl today: A semicolon is required after every statement, except before a
closing curly or end of file.
Perl 6: A semicolon is also required after every block, except when the
closing curly is on a line of its own, or it precedes another closing curly
or end of file.

As far as whitespace, you can get around that

if%foo{"key"}->{print"Hello"}   # -> and \s{ are kinda equivalent
if%foo->{"key"};{print"Hello"}

Using -> like that would be evil. We should put it in the test suite now...

Ashley Winters

Reply via email to