On Mon, Apr 19, 2004 at 10:37:57AM -0500, Abhijit A. Mahabal wrote:
: >     $obj.meth,                      -> obviously not arguments
: >     $obj.meth $foo,$bar             -> obviously arguments
: >
: 
:  $obj.meth() + $bat                     -> obviosly not arguments
:  $obj.meth () + $bat                    -> obviosly not arguments

No, obviously arguments.  Okay, I see the problem.  What you're missing
is that in an earlier Apocalypse, we said that postfix subscripts
and argument lists may not have an intervening space.

:  $obj.meth ($foo + $bar) + $bat         -> ambiguous, likely to be list

No, obviously arguments.

:  $obj.meth($foo + $bar) + $bat          -> $foo + $bar the argument

Correct.

:  $obj.meth($foo + $bar), $bat           -> list

No, if you mean that $bat is the final argument to the method call.
Yes, if by that you mean the list is outside the method call.  The
absence of a space makes ($foo + $bar) a postfix argument-supplying
operator.  So this is parsed:

    ($obj.meth($foo + $bar)), $bat

: Is that about the story so far? Or is the last example probably going to
: be illegal without a space?

It's certainly not illegal, but it won't do what you want if you think
it'll pass $pat to $obj.meth.

: How bad is it to require space before arguments that are a list, so that
: the no-space case is unambiguous?

It may turn out that all the unambiguous cases do in fact require space
before the list (unless you use the explicit colon).  However, that doesn't
necessarily make it beneficial to declare that

    $obj.meth+1

is unambiguous in the other direction.  I think if something is going
to be unclear to the *reader* of the code, we should probably not
make it easy to write it that way.

Larry

Reply via email to