sub my_context_sensitive { return $someobject but { method Str { # code for computing the string representation } method list { # code that's called in list context } ... } }
So the cost of that is just creating a closure for each "overloaded" context.
In reply to Re^3: Contexts and Perl 6
by moritz
in thread Contexts and Perl 6
by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |