On Tue, 27 Aug 2002, Luke Palmer wrote:
> No, it's right. But it doesn't break that. In the grammar, C-like
> languages include (something like):
>
> statement: expression ';'
> statement: if expression block
>
> So an if _statement_ terminates itself. The } on a line of its own is a
> special exception for closing braces that would also need a semincolon,
> as in C<eval> (that is, C<try>), et cetera.
This breaks the simple interpretation of the "users can write their own
control structures and builtins" rule. Instead of being able to define
sub myif($test, &cond) { ... }
it's now necessary to do that, then modify the grammar:
statement: 'myif' scalar_expr block
Damian/Larry -- is this the way things are going? And if so, why do we
need to make '}' on a line by itself _ever_ be a statement terminator, if
we expect grammar modifications to handle cases where '}' actually ends a
statement? It seems to just make things like this:
$x = { 1 => 2, 3 => 4
}
$y = { 1 => 2, 3 => 4,
5 => 6 } # needs ';'
confusing.
/s