On Thu, 24 Oct 2002, fearcadi wrote:
: Maybe , my question really is , how perl will behave if I will do
: 
: sub operator:=+ (str $x, str $y) { system( "$x | $y" ) } ;
: 
: so this is more question of qrammar ?

The general rule in most lexers has always been that it grabs the
longest token it can recognize.  So adding that definition would
change the meaning of

    $a=+$b;

unless the lexer has a built-in rule that allows it to recognize
operators that haven't been defined yet.  It's tempting to
require whitespace after certain classes of operators, but it
would certainly enrage a segment of the population.

On the other hand, the current rule for recognizing the *end* of a
name in the style of operator:=+ is to go till the next whitespace,
on the assumption that we'll never have (shudder) whitespace operators.

But that doesn't mean we have to require whitespace after every
operator.  Putting the whitespace merely guarantees that it will
never be interpreted as a longer operator.

I think putting whitespace around any operator containing "=" is a
really good idea just on general principle.  But I'm not willing to
inflict my principles on people mandatorily unless there's a really
good reason (as I think there is with mandatory curlies).

Larry

Reply via email to