HaloO Juerd,

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

I've put it below Sub in my type lattice. But that is not official,
of course.


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:

Please help me to understand how the context starts to exist.
I currently see a circular definition of comma and list context
in your explaination. I for my part try to break it with the
strict notion: "when you see a comma you are looking at a list".
What list is up to more text to the left and right of the comma.
And I believe the parser essentially does the same.


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

That @foo is of syntactic type Array is clear. That bar is called
without parameters is obvious as well. But where do you derive the
the return type from? That could at most come from type information
of bar e.g. :( Void --> Blubber) and then the question arises if
a Blubber is assignable to an Array or not. Well, or if a Blubber
can listify. Or as a fall-back itemize with the item beeing trivially
listified as a one element list which then ends up providing the sole
content of the @foo.


 \($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.

Ups, I always thought that this is what all the operator categories
and related things are for: to get an easy way to define operators!
E.g. after

  my &foo ::= &prefix:<\>;

enreferencing should work with

  ($x,$y) = foo($a,$b);

or not?
--
$TSa.greeting := "HaloO"; # mind the echo!

Reply via email to