Re: what happened to that new isset() like language

From: Date: Sun, 30 Oct 2005 18:02:36 +0000
Subject: Re: what happened to that new isset() like language
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-19847@lists.php.net to get a copy of this message
Marcus, my point was that this simple function: function ifsetor(&$var, $value) { return (isset($var)) ? $var : $value; } can be done in userspace, and that a coalesce() like function will have the added benefit of a variable number of parameters, which as far as I know, cannot be done in userspace, because call-by-reference cannot be done using func_get_args(). That was all, take it easy :) Ron "Marcus Boerger" <helly@php.net> wrote in message news:10757231.20051030104756@marcus-boerger.de... > Hello Ron, > > damn it! ifsetor or any equivalent cannot be done in userspace. If you > don't get don't write here. > > 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" <sean@caedmon.net> wrote in message > > news:43643EDF.1010301@caedmon.net... > >> 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

« previous php.internals (#19847) next »