Hi Marcus, > ifsetor or any equivalent cannot be done in userspace.
i agree here. Last time this topic has been discussed I've naively asked for opinions regarding a userland implementation. Afterwards the discussion suddenly ended. In the meantime I've tried to use it more often but found myself typing those $a = isset($arr[with][many][keys]) ? $arr[with][many][keys] : ... statements again because my userland ifsetor() simply doesn't do what I needed. I also agree with Marian on this: > Whatever the name is, I think the most important thing should be > that second argument is not evaluated if the first one is set. $b = ifsetor($a, do_expensive_operation()); After really having tried to use the userland ifsetor() discussed on this list some months ago, I believe that a more useful ifsetor() would: 1. not touch $a 2. not call do_expensive_opertion() when $a is set. Just my two cents to a bikeshed's color ;) -- Sven > marcus > Sunday, October 30, 2005, 9:52:47 AM, you wrote: >> I'm a big fan of coalesce($param1, $param2, ..., $paramN) (or firstset()). >> The syntax allows for more than what ifsetor($var, $value) would do. >> Ifsetor() could be done in userspace, but I don't see how coalesce() could, >> because of the variable number of parameters. >> Ron >> "Sean Coates" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >>> Bob Silva wrote: >>> > It should be a function and not a language construct IMHO. Either >> ifsetor or >>> > overload the isset statement (which may not be possible within the >> engine). >>> >>> It _has_ to be a language construct, and not a function (otherwise, we'd >>> get a notice when first using the variable). >>> >>> It could, however, be a language construct that LOOKS like a function. >>> This is how isset() and empty() work. >>> >>> Also, if this was possible as a function, it could be solved in >>> user-space, and we wouldn't be having this conversation. >>> >>> (not that I claim to be an internals expert.. if I'm wrong, feel free to >>> correct me) >>> >>> To pitch in my 0.02 CAD: this functionality is valuable to me, but I >>> don't care what we name it, or how it works. I could also live without >>> it: isset() + ternary + redundant typing. >>> >>> S > Best regards, > Marcus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php