On Thu, Jul 22, 2004 at 08:23:21AM +0200, Juerd wrote:
: Larry Wall skribis 2004-07-21 12:25 (-0700):
: > I'm inclining more towards the "only interpolate things that end with
: > brackets or parens" rule.  That would allow $foo.bar() to interpolate,
: > but not $foo.bar.
: 
: Anything that is decided by something's end makes things hard to read,
: hard to learn and probably harder to parse. Why fix this with regexes
: and then reintroduce it in interpolation?
We've been saying "end brackets", but that's misleading.  The difference
between regexen and this is that the abc in /abc/x could be arbitrarily
complicated.  With the so-called end bracket rule, the most complicated
thing you can get before going into "bracket mode" is basically

    @abc.def()

where abc and def are simple identifiers.  So you don't have to look
arbitrarily far ahead to find the brackets.  Even if you have a hairy
subscript after that, you already know it's interpolating something
just by examining the *first* bracket:

    @abc.def()[1]{"foo"}(1,2,3).sort().join(" ")

It's those inital parens that mean "interpolate", not the final parens.
(The final parens only influence the meaning of ".join".)

Local context is much easier to deal with than distant context, and that's
the difference we're dealing with here.

Larry

Reply via email to