[PHP4BETA] New feature? (was: Is this a bug? Default params?)
| From: | George Hartz | Date: | Tue, 10 Aug 1999 13:59:26 +0000 |
| Subject: | [PHP4BETA] New feature? (was: Is this a bug? Default params?) | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-3280@lists.php.net to get a copy of this message | ||
Samuel Liddicott wrote:
> > A better option, given the assumption that it can't be changed, is to
> > add a simple shorthand for it, something like this:
> >
> > $Username ?= $GLOBALS["login"]["username"];
> >
> > Figuring that "?=" is semi-intuitive for "equals if not set" or
> > something along those lines...
> >
> > Actually, now that I've said that, I really like the idea! :)
>
> I do too, very nice.
>
> But what I was saying is if we can type that as the first few lines of the
> function, why can't this JIT compiler pretent we did? JIT or not it should
> make no difference, as that code would be executed before any major
> conditionals.
I don't know, maybe the Zend people can comment on this? There wasn't a
clear explanation given why support for it was dropped, that was just my
guess...
> Nice idea of yours. Does that work for not-set, or for not-true?
Well, I'd envision it as non-set, there's already the C-like ? operator
for true/non-true, which is sort of a shorthand for an if/else
combination. By coding it as a set-if-not-set function, you avoid the
if/else combination as well as a function call to test if a variable is
set.
I tried looking at the Zend source and lets just say its been WAY too
long since I've used yacc to figure out how to add it, even to play
around with how useful it would be.
Any comment from the Zend-gods? I'm not sure where to submit it for a
suggestion, since its not a PHP feature but a Zend feature...
- George
--
email:dotorg@bangsplat.org;url:www.bangsplat.org;uin:153182;aim:tgd98
GCS/GP/GS/GFA d- s+: a- C++++$ UL++++$ P+++$ L+++$ E- W++>$ N+@ !o
K+++ w--- !O M-@ V PS+ PE Y+ PGP t-(+) 5- X++ R-(--) tv+ b+++ DI++ D++
G+ e* h r y++