in reply to Operator overloading with returning lists?
I want to overload an operator (ideally '~~') but want the result to be a list. It seems like that's not possible, the list is only handled like in scalar context.Indeed. There were some messages on p5p about this quite recently. I think the outcome was "No, that's not possible. The implementor (Ilya) of overloading deemed it not necessary to be able to ask the context - that is, the operands are always in scalar context".
Note that when overloading was implemented, '~~' wasn't an operator, and only a few overloadable operators would behave differently in list context anyway. (<> being the obvious on. x behaves different in list context as well, but only if its LHS has parens, making it an odd one).
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Operator overloading with returning lists?
by ikegami (Patriarch) on Nov 27, 2008 at 23:09 UTC | |
by JavaFan (Canon) on Dec 01, 2008 at 10:54 UTC | |
by LanX (Saint) on Dec 01, 2008 at 14:42 UTC | |
by ikegami (Patriarch) on Dec 01, 2008 at 16:33 UTC | |
by Anonymous Monk on Dec 01, 2008 at 15:01 UTC | |
by LanX (Saint) on Dec 01, 2008 at 15:31 UTC | |
| |
by JavaFan (Canon) on Dec 01, 2008 at 15:54 UTC | |
by LanX (Saint) on Dec 01, 2008 at 16:03 UTC | |
|