TSa skribis 2005-09-19 18:16 (+0200):
>   sub &*prefix:<\> (Item *$to_enref --> Ref ^ List[Ref]) {...}
>   # For the type inferencer it were a great thing to leave
>   # the hint that Item --> Ref and List --> List, but how do
>   # I write that? Is it (*$t, [EMAIL PROTECTED] --> @rest ?? List !! Ref)?

Does the type "List" exist? What is it? How does it fit in the
hierarchy?

> >What do you want , in that comma to do?
> I don't understand that question. Comma does what it does---everywhere.

/in that comma/in that context/

> It syntactically instructs the compiler to generate code that builds
> a list from the expressions that comma happens to separate.

Well, that's not exactly accurate.

In list context, comma provides list context to LHS and RHS, and those
lists together are flattened. (It's not exactly binary, but it doesn't
hurt to explain it as such.)

In scalar context, commas provide scalar context to the expressions they
separate (or list context? If so, what to do with parenthesized
expressions?), and the entire thing is returned as a reference to a
newly created array (of aliases, perhaps).

What it does in void context is unimportant, but it would make sense if
it provided void context to each of the expressions.

Comma doesn't "build a list". Lists can only exist in list context, and
in fact, it's a list even without any comma:

my @foo = bar();  # here, what &bar returns is a list, without any
                  # comma.

>   \($x,$y);  # same as \ .($x,$y)

This would mean that \ is a function rather than a standard \W operator,
and that the parens here aren't the normal grouping parens, but instead
parens to enclose arguments. If this is the case, I suggest we rename \
to something that actually LOOKS like a function, that is: something
with a \w+ name. This all would imply that its precedence is lower than
comma.


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Reply via email to