Oops, my bad.
Forgot all about that life isn't always the same in Hilfe land as in "default" pike
zero_type(lambda(){}());
(3) Result: 0
zero_type(lambda(){return UNDEFINED;}());
(4) Result: 1
Got confused by that the type of result wasn't (isn't) preserved in Hilfe.
NB: zero_type() will never give the right answer for values retrieved from Hilfe's result-history.
//K
Kaos wrote:
Hi,
The return value from a lambda gets "int'ified" so I am not able to distinguish a "return 0;" from a "return UNDEFINED;".
I guess it's not too hard to fix, but might break something?
Is there a workaround.. what can I do?
Ex: Pike v7.7 release 9 running Hilfe v3.5 (Incremental Pike Frontend)
function a = lambda( int b ){ if( b > 0 ) return b-1; if( b == 0 )
return UNDEFINED; };
a(2);
(2) Result: 1
a(1);
(3) Result: 0
zero_type(_);
(4) Result: 0
a(0);
(5) Result: 0
zero_type(_);
(6) Result: 0 // would like zero_type to return 1 here!
a(-1);
(7) Result: 0
zero_type(_);
(8) Result: 0 // I expected UNDEFINED, since nothing was
// returned from the lambda..
//K