Hi,
I found out that I can do:
array a = ({ 1, 2, 3 }); array b = ({ 4, 5, 6 }); a[*] | b[*];
(1) Result: ({ /* 3 elements */ 5, 7, 7 })
But not:
array c = ({ 3, 0, 2 }); c[*] || a[*];
Compiler Error: 1:[*] not supported here. Compiler Error: 1:[*] not supported here.
Any hints on where to go patch to make the above work? (expected result: ({ 3, 2, 2 }) )
When is this usefull? For example when I have an array containing the arguments for some function call (or object creation) and get another array with some values to override.
//K
|| isn't an operator that can be used like that. You can't do for instance `||(@arr).
It can be discussed if there should be an `&& and an `|| (and an `^^) though.
The reason why it doesn't work is that the right side of the statement may not be executed, so || and && are more special then normal operators.
Mirar @ Pike developers forum wrote:
|| isn't an operator that can be used like that. You can't do for instance `||(@arr).
It can be discussed if there should be an `&& and an `|| (and an `^^) though.
The reason why it doesn't work is that the right side of the statement may not be executed, so || and && are more special then normal operators.
Ah, yes. Good point. Thanks :)
On Sat, Nov 13, 2004 at 05:09:49PM +0100, Kaos wrote:
array c = ({ 3, 0, 2 }); c[*] || a[*];
Compiler Error: 1:[*] not supported here. Compiler Error: 1:[*] not supported here.
this has been discussed here: http://lists.lysator.liu.se/pipermail/pike-devel/2004-September/007722.html a workaround is here: http://lists.lysator.liu.se/pipermail/pike-devel/2004-September/007731.html
greetings, martin.
Martin Bähr wrote:
On Sat, Nov 13, 2004 at 05:09:49PM +0100, Kaos wrote:
array c = ({ 3, 0, 2 }); c[*] || a[*];
Compiler Error: 1:[*] not supported here. Compiler Error: 1:[*] not supported here.
this has been discussed here: http://lists.lysator.liu.se/pipermail/pike-devel/2004-September/007722.html a workaround is here: http://lists.lysator.liu.se/pipermail/pike-devel/2004-September/007731.html
greetings, martin.
Oh, remeber I read that.. didn't pay enough attention, obviously ;)
pike-devel@lists.lysator.liu.se