Re: what happened to that new isset() like language
| From: | Greg Beaver | Date: | Sat, 29 Oct 2005 21:56:16 +0000 |
| Subject: | Re: what happened to that new isset() like language | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-19827@lists.php.net to get a copy of this message | ||
Sara Golemon wrote:
>>> Evaluating an idea based on it's syntactic similarities to other
>>> languages is complete and utter nonsense. It has nothing to with being
>>> like language Xyz. It has to do with familiarity to language constructs.
>>> One already understands the idea of 'this || that'. It's certainly
>>
>>
>> I'll throw the water on this one:
>>
>> <?php
>> $c = 0;
>> $a = 1;
>> var_dump($c || $a);
>> ?>
>>
>> Changing true into false consitutes a rather severe BC break :).
>>
> How about ||| and |||= ?
I don't think the meaning of this operator is obvious. Right now, the
only operators whose meaning are not immediately obvious (in my eyes) are:
@ - error suppression
& - make reference in some cases, bitwise and in others
^ - bitwise xor but what are you gonna do :)
For an operation as complicated as "use the first variable that exists"
I would be most comfortable with:
$d = first-existing: $a, $b, $c;
This way, no conflict with functions (parse error in previous php
versions), and it is extremely clear. The parser would look for
T_FIRSTEXISTING ':' existing_varlist
in the expression section, and of course defining existing_varlist as:
existing_varlist:
variable
| existing_varlist ',' variable
;
Greg