Date: 07/01/00
- Next message: wade <email protected>: "[PHP-DEV] PHP 4.0 Bug #5332: ODBC Connect Fails for Sybase SQLanywhere DB"
- Previous message: Lukasz Michalski: "[PHP-DEV] mktime()"
- In reply to: waldschrott: "Re: [PHP-DEV] Ternary operator enhancement for fluent code"
- Next in thread: Dominic J. Eidson: "Re: [PHP-DEV] Ternary operator enhancement for fluent code"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 09:58 PM 7/1/00 +0200, waldschrott wrote:
>Hi Rasmus,
>Hm, you´re not right, not forcible. Not every enhancement makes sense. But
>if no one adds functionality to a livinig language there´s no progress...
>
>I think at least !! and ?? are worth a try, I could apply them very often
>and it isn´t as complicated as you promoted it:
>
>if(!!$a) { $b = $c ?&? $d; }
>if variable $a not equals FALSE, set var $b to $c(if set) else to $d.
>
>Nothing complicated in here, I did know that Andi,you and co wouldn´t like
>them (deviation from C,Java...), thus I´ve only posted the most important
>one (?? op) - if you think of PHP better beeing easier to read, without
>the need to think, for everyone than adding mighty operators for
>experienced ones, gaining sore fingers by typing:
>
>if ($var_1!==FALSE) { if (isset($object1->current_state)
>$retval=$object1->current_state; else $ret=$object2->current_state; }
>
>what could be done using
>if (!!$var_1) $ret= $object1->current_state ?&? $object2->current_state;
>
>, then I`ll possibly have no chance at all.
You won't have a chance using such cryptic syntax. It is not worth the loss
in readability and "compatibility" to other languages.
>>He will curse you and your family since this does not look like anything
>>else in any other language, and it is difficult to look up !! or ?&? in an
>>online manual.
>That´s not true, just go to operators->comparison op->(...) and you´ll
>find "!!" and "??", not significantly harder than trying to find "?:"
>
>> >From a performance point of view there is minimal gain here as the opcodes
>>generated will be the same and the 6 or 8 less bytes the parse has to
>>parse is insignificant.
>
>I´ll have to trust you, I don´t know much about these internals.
Actually Rasmus isn't 100% right here. Theoretically it might allow us to
implement them a tad bit faster but you will most probably not notice a
difference in overall script performance.
>At least !! is an enhancement that would fit to PHPs peculiarities like
>"automatic conversion"...
If you think !! is peculiar then that is a good reason not to add it :P
Andi
--- Andi Gutmans <andi <email protected>> http://www.zend.com/-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: wade <email protected>: "[PHP-DEV] PHP 4.0 Bug #5332: ODBC Connect Fails for Sybase SQLanywhere DB"
- Previous message: Lukasz Michalski: "[PHP-DEV] mktime()"
- In reply to: waldschrott: "Re: [PHP-DEV] Ternary operator enhancement for fluent code"
- Next in thread: Dominic J. Eidson: "Re: [PHP-DEV] Ternary operator enhancement for fluent code"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

