George just pointed out that this isn't quite right :) The point is that we've got the guts, it's just a few tweaks to get it into the parser.
--Wez. ----- Original Message ----- From: "Wez Furlong" <[EMAIL PROTECTED]> To: "Marcus Boerger" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Cc: "Jason Garber" <[EMAIL PROTECTED]>; "Andi Gutmans" <[EMAIL PROTECTED]> Sent: Friday, April 16, 2004 9:19 PM Subject: Re: [PHP-DEV] [RFC] ifsetor operator > It's worth nothing that, if T_IFSETOR was recognized by the > scanner as "?:", then Sascha/GCC "?:" operator is also implemented > by this patch, by changing the parser rule from this: > > T_IFSETOR '(' variable ',' expr ')' > > to this: > > T_IFSETOR variable ':' expr > > --Wez. > > > ----- Original Message ----- > From: "Marcus Boerger" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Cc: "Jason Garber" <[EMAIL PROTECTED]>; "Andi Gutmans" <[EMAIL PROTECTED]> > Sent: Friday, April 16, 2004 8:38 PM > Subject: [PHP-DEV] [RFC] ifsetor operator > > > > [RFC] ifsetor operator > > > > Hello List, > > > > i also agrre that an internal function is much better. And here is > > it as such an internal function (that does not result in an expensive > > function call). > > > > Synopsis: "ifsetor" "(" value "," default ")" > > > > Returns the value if it exists or a given default value. > > > > Syntax: "ifsetor" "(" variable [ "," expression ] ")" > > > > Semantic: > > - The value in question must be a variable. > > - The default value can be any expression. > > - The default value can be omitted in which case NULL will be used. > > > > http://marcus-boerger.de/php/ext/ze2/ze2-ifsetor-20040416-2.diff.txt > > > > best regards > > marcus > > > > > > Friday, April 16, 2004, 2:12:04 AM, you wrote: > > > > > Hello Jason, > > > > > here is your operator patch: > > > http://marcus-boerger.de/php/ext/ze2/ze2-ifsetor-20040416.diff.txt > > > > > currently it uses the following syntax: > > > > > $var $: $defaul > > > > > which would equal > > > > > isset($var) ? $var : $default > > > > > Notice that at the moment the operator is '$:' and not '?:'. This is > > > because i haven't looked on how to solve the conflicts i get when i > > > use '?:'. If there is more interest in that operator i could invest > > > more work in trying to fix that problem. > > > > > best regards > > > marcus > > > > > According to your options and the possibility to implement this as a > > > function. That would only work as a parser internal function like empty > > > or set. Doing so would be very easy i guess. Though it would require a > > > new keyword say 'ifsetor' (which reflects its purpose more as 'setor'). > > > > > best regards > > > marcus > > > > [...] > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php