HaloO Larry,

you wrote:
We can do whatever we like with \ since it's really a *macro* that

Could you explain me the rational why \ and other ops like =,
:= are not normal overloadable, possibly MMD operators?

imposes lvalue context (or at least, indirection in the abstract, if
we were ever to allow it in an outer lvalue context).  In the case of
\($a,$b) it is also distributing that context over the items in the
list without copying.

With the precedence of \ higher than that of comma the parens are
again needed to prevent the parsing as ((\ $a),($b)). Thus with
a multi \ in mind \($a,$b) just dispatches to the list version
of \. Since comma builds a lazy list the $a and $b are not evaluated
right on the spot.

The only questions in my mind are whether Perl 5's \($a,$b) is
what people expect (it's arguably counterintuitive to newbies),
and whether there's some other construct that would more naturally
construct a list of references.  It's not just \« though, since it
has to *parse* as a list of lvalues.

Why does it have to parse as lvalue list? My understanding of List
as Code subtype means that handling a lazy list means traversing
or iterating it. Why shouldn't there be a lvalue traversal that
in the end makes

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

actually mean

  $x = \$a; $y = \$b;

My point revolves around the question: "how much snapshotting does
lazy list creation perform?". I mean it's clear that

  $val_snap = ($a, $b); # List of Item

prevents the content of $a and $b become invalid (but the variables
could be made to point elsewhere of course). Then

  say $val_snap;

should just produce the same result as

  say $a, $b;


  $ref_snap = \($a, $b); # either: Ref  of List of Item
                         # or:     List of Ref  of Item
hooks onto the containers and

  say $ref_snap;

well either prints info about $ref_snap beeing a (list of) ref(s)
or is so kind to deref it and print the content of $a and $b at that
time. So the only thing we have to agree on the type of &prefix:<\>.
Either it is the generic :(List of Item --> Ref of List of Item) or
the more Perl 5 stylish :(List of Item --> List of Ref of Item).

The above distinction between Ref of List and List of Ref then
needs to be reflected almost everywhere. Basically the choice we
have to make is if \($a,$b) is primarily a List or a Ref :)
The respective other info can then be found by derefing or

 Maybe a siglet can degenerate to
that, but there are problems with that approach too.  Unless someone
can come up with a better proposal, \($a,$b) is the default winner
on the basis of prior Perl 5 art.

I actually like \($a,$b) and I hope it means the same as \ ($a,$b)
note the whitespace!
$TSa.greeting := "HaloO"; # mind the echo!

Reply via email to