> Date: Tue, 4 Feb 2003 01:57:00 +0100
> From: =?iso-8859-1?Q?St=E9phane?= Payrard <[EMAIL PROTECTED]>
> 
> In the tradition of Perl concision, I would like newline to be a
> statement terminator everywhere it can: that is when 
>        a) the parser expects an operator 
>  _and_ b)  we are not in the middle of a parenthesised expression.

Can you say "Ruby"?

No, I think a semicolon should still be required to seperate
statements.

> Accessorily, it would also help people to switch back and forth
> between language that use newline as statement terminator and perl6:
> they will not be burn anymore when forgetting a semicolon.

Of course, error detection as far as semicolons go is getting much
better.  Parsers can determine (usually) exactly which line the
semicolon was left off of.

> Note that in Perl5, semicolon is not always required as statement
> terminator.  At the end of a scope, being a closing brace, or the end
> of a program, including an explicit eval or an implicit one (perldb
> shell).

That's because, in Perl 5, semicolon is not a statement terminator.
It is a statement I<separator>.  That is why you don't need it at the
end of various places, because you don't need to separate it from
anything. 

> About the b) rule.
> ------------------
> 
> The following code does not parse because of the newlines that are
> interpreted as statement terminator.
> 
>   for 
>   1..10
>   { ... }
> 
> But
> 
>   for (
>     1.. 10
>   ) {
>   } 
> 
> is legit.

See, this is the main, unPerlish thing you're doing.  You're enforcing
particular styles upon people, something Perl is proud of *not* doing.

Let's not forget the often occurence of:

    $fh = open 'foobar'
            or die "Can't open foobar: $!";

An implicit semicolon would cause it to croak there.  

Also, s/or/$(any <<if unless for while when ...>>)/

It would be trivial with a grammar munge to implement this (heck, I
did it with a source filter in Perl 5).  Surely CPAN6 (6PAN/CP6AN/??)
will come out with one of these right off the bat, so you could do:

    use Grammar::ImplicitSemicolon;

Or something like that, and be done with it.

Luke

Reply via email to