On Wed, Apr 20, 2005 at 07:17:14PM +0200, Juerd wrote:
: Must LABEL be quoted/a normal string?

Forgot to answer the more general question.  Presuming we still have

    next LABEL;
    last LABEL;
    redo LABEL;
    goto LABEL;

how do we parse something like this

    goto join "", "L", { rand 10 } XX rand 10;

without doing inconsistent autoquoting or confusticating the current
subroutine namespace with the label space?  I think the answer is
that those control keywords always autoquote the next identifier,
and if you want to do something run-timeish, you have to say

    goto(join "", "L", { rand 10 } XX rand 10);

or, slightly more problematically,

    (join "", "L", { rand 10 } XX rand 10).goto;

(slightly more problematic insofar as .goto is presumably not a
built-in method on Str, so you're relying on failover to MMD.)

Anyway, with these rules, goto LABEL and friends can just automatically
quote the next identifier if there is one, and not worry about it
otherwise, just as => only autoquotes its left side if it's an identifier.

Or did we open that up to general names like Foo::bar?  I don't recall.
Hmm.  What would it mean to goto a class?

And if we write

    Foo::Bar => 1,
    Str => 2,

do we care that class names are getting string typed in the pairs'
keys, if you can use a string as a class name anywhere?  Or maybe
we don't care the other direction, insofar as, if the => autoquoter
ignores predefined class names and types them as classes, but classes
always stringify to their own name anyway, so it doesn't matter.  Hmm.
That's probably better, since with the first approach we'd have to make
sure that Str supports class methods somehow, if only by failover to MMD.

It would be kind of nice if autoquoting policy were similar between =>
and goto, but maybe that's a foolish consistency.  We've never allowed
:: in labels before, whereas I can see lots of uses for class names
on the left side of pairs.

I think I'm arguing myself out of autoquoting :: names.  So in

    Foo::Bar => 1,
    Str => 2,

I think it should autoquote Str only, and then if you really mean
the class there instead of the autoquoted string, you should say

    ::Str => 2,

instead.  And now we don't have a problem with consistency.  Autoquoted
labels are limited to bare identifiers also.

Larry

Reply via email to