S12 is now clarified to indicate that $object.$methodname() is able to call into a closure as well as into a named method. Thanks.
"Thanks"? No, thank you! (I added a link to the quote above and I'm reporting hereafter the relevant part of the Synopsis.)
The variable may contain either the name of a method or a closure object. In the latter case the closure is called with the object as its first argument, so that a closure may be used to abstract a "navigational" path through a data structure without specifying the root of the path till later.
$locator = -> $root, $x, $y { $root.<foo>[$x]<bar>{$y}[3] } $obj.$locator(42,"baz") # $obj<foo>[42]<bar><baz>[3] $locator = { .<here> } $obj.$locator # $obj<here>
In reply to Re^4: [Perl 6] Any provision for a "dereferencing object"?
by blazar
in thread [Perl 6] Any provision for a "dereferencing object"?
by blazar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |