C. Scott Ananian wrote:
I think Ingo was trying to explicitly specify the normally-implicit invocant; ie, invoke the method via the reference *without* using a '.'.
If this is possible (and I think it is), it's not (yet) clear what the
syntax would be. Maybe
$ref(Foo.new():)

I think for MMD calls no : is needed. The dispatcher should find the best
match for the complete set of args anyway. The problem is to hit the
intended recipient when there's no argument other than $_ which was just
recently re-instated as the default invocant. Even though a simple $ref.()
might know from the type of $ref which is 'Ref of Method of Foo', to
invoke a method on $_, I would expect a type error unless $_ happens to refer to a subtype of Foo.


Since Ingo's simple example doesn't need an invocant at all the following
might work

  class Foo
  {
     method bar(Any:) { 42 }
     method baz() { &bar }
  }

But I think it's better to make &bar a sub.
--
TSa (Thomas Sandlaß)



Reply via email to