in reply to Re^2: Contexts and Perl 6
in thread Contexts and Perl 6
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Contexts and Perl 6
by John M. Dlugosz (Monsignor) on May 18, 2009 at 21:19 UTC | |
by moritz (Cardinal) on May 18, 2009 at 21:23 UTC | |
by John M. Dlugosz (Monsignor) on May 18, 2009 at 21:29 UTC | |
by moritz (Cardinal) on May 18, 2009 at 21:34 UTC | |
by John M. Dlugosz (Monsignor) on May 18, 2009 at 22:01 UTC |