Simplified operators

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Simplified operators

Martin Nilsson (Coppermist) @ Pike (-) developers forum
So I've been bugfixing and merging the code from the simplified
operators branch. I just fixed so that UNDEFINED is always ignored
when adding arrays, mappins and multisets, and not just as first
argument.

Previously:

Pike v8.1 release 6 running Hilfe v3.5 (Incremental Pike Frontend)
> `+( UNDEFINED, ({1}), ({2}) );
(1) Result: ({ /* 2 elements */
                1,
                2
            })
> `+( ({1}), UNDEFINED, ({2}) );
Bad argument 2 to `+(). Expected array.
Unknown program: `+(({1}),UNDEFINED,({2}))
HilfeInput:1: HilfeInput()->___HilfeWrapper()

The remaining issue I have is what to do when an addition LFUN returns
UNDEFINED. I interpret Pers commit message as he was leaning towards
having an object return UNDEFINED mean to not involve the object,
though there was no code to back that up. I lean towards having
returning UNDEFINED be an error, since the object can just as well
return the value it was given. In any event, the current behaviour is
wrong:

Pike v8.1 release 6 running Hilfe v3.5 (Incremental Pike Frontend)
> class A { mixed ``+(mixed x) { return UNDEFINED; } }
> `+( ({1}), A(), ({2}) );
(1) Result: ({ /* 1 element */
                2
            })
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Simplified operators

Martin Nilsson (Coppermist) @ Pike (-) developers forum
I went ahead with making UNDEFINED as a response from `+ and ``+
illegal.
Loading...