On Sun, May 23, 2004 at 11:54:23AM -0700, Chris wrote: : I may have missed an obvious answer to this question, but has any thought : been given to allowing for variables which behave as though ever operation : on them is the hyper version of that operation? Sort of an automagical way : of redefining a LOT of operators.
That's just regular overloading via multiple dispatch, I expect. (You could do the same in Perl 5, only without the multiple dispatch.) To do so generically you'd probably want to include the operators via role rather than via inheritance to keep the dispatcher from taking their generic "distance" into account, or you could end up calling the wrong set of methods in pathological cases. On the other hand, I can well imagine situations in which a PDLer might just want to declare all operators to be hyper, in which case a pragma would work nicely. (Hyper operators degenerate to scalar if both sides are ordinary scalars, but there's more bookkeeping, so it'd probably run a little slower in some cases. On the other hand, you wouldn't have to put »« on any of your hyper ops, which is worth something...) Larry