in reply to Contexts and Perl 6
What it is, fundamentally, is information that propagates into functions, which can affect the behavior of the function if the code chooses to examine and act on it.
In Perl 6 we're moving away from that notion, because multi dispatch doesn't allow that concept to work very well (and which is why I proposed to get rid of want(), which tells you that context).
Consider for example
multi sub a(Str $x) { ... } multi sub a(Bool $x) { ... } a(b()); # is b() here in Bool or in Str context?
Instead contexts are common type coercions to which all (or nearly all) objects know how to respond. So when in Perl 5 a function would ask for its context, in Perl 6 it returns an object instead which behaves appropriately in all contexts.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Contexts and Perl 6
by John M. Dlugosz (Monsignor) on May 18, 2009 at 18:37 UTC | |
by TimToady (Parson) on May 19, 2009 at 16:07 UTC | |
by John M. Dlugosz (Monsignor) on May 19, 2009 at 18:21 UTC | |
by TimToady (Parson) on May 20, 2009 at 00:19 UTC | |
by John M. Dlugosz (Monsignor) on May 20, 2009 at 15:25 UTC | |
| |
|
Re^2: Contexts and Perl 6
by John M. Dlugosz (Monsignor) on May 18, 2009 at 19:04 UTC | |
by moritz (Cardinal) on May 18, 2009 at 20:56 UTC | |
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 | |
|