Re: Ternary operator enhancement for fluent code
| From: | waldschrott | Date: | Sat, 01 Jul 2000 13:07:35 +0000 |
| Subject: | Re: Ternary operator enhancement for fluent code | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-23140@lists.php.net to get a copy of this message | ||
Hi Jade,
if you liked that idea, I´ll tell you which enhancement I´d found very helpful (I collected them working on thousands lines of code, they´re practically orientated and will be very useful):
(1)
PROPSED SYNTAX !!$val
MEANING extended negation w check
LONG EXPRESSION $val!==FALSE
(2)
PROPSED SYNTAX $val1 ?? $val2
MEANING Reduce-enhanced ternary op
LONG EXPRESSION
1. if (!($pos=$val)) $pos=$val2;
2. return $pos;
(3)
PROPSED SYNTAX $val1 ??? $val2
MEANING Reduce-enhanced ternary op, 0 safe
LONG EXPRESSION 1. if (($pos=$val)!==FALSE) $pos=$val2;
2. return $pos;
(4)
PROPSED SYNTAX $val1 ?&? $val2 (found no better syntax)
MEANING Reduce-enhanced ternary op, 0 safe
LONG EXPRESSION 1. $pos= isset($val) ? $val : $val2;
2. return $pos;
Overall these improvements would mean:
- smaller code
- faster executing
- no additional ambiguities
That means: Faster and better development for the experienced and if documented thoroughly even for newbies and intermediates...
That´s optimizations who wouldn´t love them?
I don´t see any negative aspects and I do not think these additional operators (which would simplify PHPs usage and increase performance) will be too complicated to understand.
--
o----------0-¬---------O-·---¬----o---®-----o o O ° .
| http://www.kiffen.de | pRoteçt y0ur bRaín |0 O ° ¤ °
·
0°·³°²'²³-¹'³´³°^°³~³²³°'³²²¨³²^³¹³²°²³`³º³°Þ °
o © ° . ·
| psychedelic experience | gott@kiffen.de | O ° o °
o-¬--o--0-----©-·--O-----o-----0-¤----------o 0 ° · ° . ¤ ·