Autrijus Tang wrote:
* deref is now 0-level; $x = 3; $y = \$x; $y++. # now an exception


That is because &postfix<++>:(Ref) doesn't exist, right?


* sub foo (?$x, ?$Inf) {}
  my $y = (x => 3); foo($y); # binds $x
  my $z = (+Inf => 3); foo($z); # binds $Inf

Isn't the lhs of => autoquoted? Why does '+Inf' as key bind $Inf?


* Constrained types in MMD position, as well as value-based MMDs, are _not_
  resolved in the type-distance phase, but compile into a huge given/when
  loop that accepts the first alternative.  So this:

    multi sub foo (3) { ... }
    multi sub foo (2..10) { ... }

  really means:

    multi sub foo ($x where { $_ ~~ 3 }) { ... }
    multi sub foo ($x where { $_ ~~ 2..10 }) { ... }

  which compiles two different long names:

    # use introspection to get the constraints
    &foo<ANONTYPE_1>
    &foo<ANONTYPE_2>

  which really means this, which occurs after the type-based MMD tiebreaking
  phase:

    given $x {
        when 3 { &foo<ANONTYPE_1>.goto }
        when 2..10 { &foo<ANONTYPE_2>.goto }
    }
  in the type-based phase, any duplicates in MMD is rejected as ambiguous; but
  in the value-based phase, the first conforming one wins.

I hope that is a temporary "solution". Usually one would expect 3 beeing a
more specific type then 2..10 irrespective of definition sequence.


  The upshot is that these are now errors:

    sub foo ($x) is rw { $x }
    my $a;
    foo($a) = 4;    # runtime error - assign to constant

I assumed lvalue subs would implicitly return void and an
assignment goes to the function slot of the args used in the assignment
and subsequent calls with these args return exactly this value.
In that respect arrays and hashes are the prime examples of lvalue
subs. Other uses are interpolated data, Delauny Triangulation etc.


Regards,
--
TSa (Thomas Sandlaß)


Reply via email to