Re: Ternary operator enhancement for fluent code
| From: | Andi Gutmans | Date: | Sat, 01 Jul 2000 14:38:11 +0000 |
| Subject: | Re: Ternary operator enhancement for fluent code | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-23143@lists.php.net to get a copy of this message | ||
Personally I don't want to add too many "weird" constructs to PHP. I think they reduce readability and go against one of the strengths of PHP which is an easy language for anyone with a C/Perl/Java background. These constructs are really cryptic.
Andi
At 03:07 PM 7/1/00 +0200, waldschrott wrote:
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)--- Andi Gutmans <andi@zend.com> http://www.zend.com/PROPSED SYNTAX !!$valMEANING extended negation w check LONG EXPRESSION $val!==FALSE (2)PROPSED SYNTAX $val1 ?? $val2 MEANING Reduce-enhanced ternary opLONG EXPRESSION 1. if (!($pos=$val)) $pos=$val2; 2. return $pos; (3)PROPSED SYNTAX $val1 ??? $val2 MEANING Reduce-enhanced ternary op, 0 safeLONG 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 safeLONG 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 ° · ° . ¤ · -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net