HaloO,

Juerd wrote:
Could you think of a formal specification of \ the way you want it, that
doesn't exist of only examples?

I can't speak for Ingo, but here's mine.


What context does it give its RHS?

I still have difficulties to understand this concept
but I think that \ is simply

  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)?

with some low-level implementation performing the enreferencing
on the engine level. There will be some more details like the
precedence trait and a bunch of named params to define how the
enreferncing shall be performed. In particular if it is a writable
ref! The latter should then look e.g. as follows:

  $x = \:rw $y;  # (almost?) same as $x := $y


What do you want , in that comma to do?

I don't understand that question. Comma does what it does---everywhere.
It syntactically instructs the compiler to generate code that builds
a list from the expressions that comma happens to separate.


> Are parens in any way special when used with \?

No. The generic rules apply. Hmm, which perhaps means that

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

returns a List of Ref, but

  \ ($x,$y);

returns a Ref of List because the whitespace before (,)
forces the list into itemhood and as such is enreferenced
as a single thing. *But* both might evaluate to the same
thing later on anyway because deref and list iteration is
part of the default coercions in Perl6.


What is the precedence of \?

Higher than comma.


The above "spec" actually can be applied to other ops as well.
E.g.

  ++($x,$y);

would work if ++ had an infinite arity signature and corresponding
implementation that handles list iteration. In other words operators
are in no way more special than

  foo($x,$y);

which raises the question if for a unary

  sub foo($item) {...}

hyperation works as expected:

  foo¬ę 1,2,3; # call &foo three times
--
$TSa.greeting := "HaloO"; # mind the echo!

Reply via email to