On Mon, May 14, 2007 at 07:05:01PM +0200, gabriele renzi wrote:
: Hi everyone,
: I don't want to argue about the design of perl6[1], I just wonder: why 
: the semicolon is still needed in the end of lines in perl6?
: I can think of different reasons (history, readability, easier parsing 
: of multiline statements, force people to write one-line functions to 
: avoid typing them :) but I'm curious to know the real one.

The "real" one, eh?

These sorts of things are almost never for a single reason.  Some of
it is my prejudice against dangling syntax, and perhaps prejudice
against anything resembling Fortran.  Some of it is not wanting to
distinguish different kinds of whitespace any more than we already do.
Some of it is simplicity of parsing, both for the human reader as
well as for the computer.  I think if I had to pick one reason,
though, it's that it allows the parser to understand the intent of
the writer much better and hence give more useful diagnostics when
something seems to be going wrong.  Much more than other languages,
Perl depends on the prohibition against two terms in a row as a kind
of "self-clocking" mechanism to disambiguate programmer intent, and
not requiring a semicolon between the final term of one statement
and the first term of the next statement would tend to weaken that,
especially when the term starts with a prefix operator that could be
mistaken for an infix.

: Sorry if this is already been explained but my google-fu was not good 
: enough to find an answer.

Honest questions deserve honest answers, even if they aren't simple answers.


Reply via email to