Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator
On Sat, 16 Apr 2011 03:42:11 +0200, Adam Richardson simples...@gmail.com wrote: On Fri, Apr 15, 2011 at 8:46 PM, Ben Schmidt mail_ben_schm...@yahoo.com.auwrote: There was also my suggestion of a checked ternary operator [see my previous email in this thread.] Backwards compatible, practical, and simple. It doesn't address the main issues of code duplication and nullness checking, IMHO, so isn't a contender. Even though it's simple and compatible, it is only practical in a handful of cases. I believe describing nullness checking as a main issue is a rather strong assessment. I agree. To me, nullness checking is not interesting at all. $var = $arr['key'] ?? : 'empty'; is a significant improvement over the current means and does in fact remove redundant code. If I understood it correctly, this is the essense of what I want. Compared to the original description of checked ternary I strongly object to this working on non-arrays. But given that constraint, my vote goes to the checked ternary operator as well. -- Ole Markus With -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator
I believe describing nullness checking as a main issue is a rather strong assessment. I don't think so, obviously. :-) $var = (isset($arr['key'])) ? $arr['key'] : 'empty'; Nullness checking is half of what that code does, isn't it? Otherwise it would be (isset($arr['key']) $arr['key']), right? Additionally, it might not be as succinct as you prefer, but surely $var = $arr['key'] ?? : 'empty'; is a significant improvement over the current means and does in fact remove redundant code. But it's not equivalent to your code snippet above, is it? My vote's still with the line of discussion Hannes and I were on, of separate 'careful array index lookup' and 'default-when-null' operator(s). Partly because I think that approach can help everyone, whereas the checked ternary operator really doesn't help me much at all. Not sure if that's selfish or not. :-) I'll try to stay a bit quieter for a bit, if I can manage it I've said a lot today. Returning due respect, Ben. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator
$var = $arr['key'] ?? : 'empty'; Also note this is possible with the recent proposal Hannes and I were discussing. It simply looks like $var = $arr?['key'] ?: 'empty'; The ?[ avoids notices and the ?: works as it always has. Ben. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] SVN Account Request: rlms
On Apr 15, 2011, at 2:23 AM, Hannes Magnusson wrote: 2011/4/1 Hannes Magnusson hannes.magnus...@gmail.com: 2011/3/31 Pål-Kristian Hamre ms.shared+lists/php-...@redpill-linpro.com: We need access to this repository to commit changes to the infrastructure: https://svn.php.net/repository/systems/ Verified. He is working on bringing the wikibox back to live, and will be committing configs and stuffz for the box to systems/ Poke Done. Welcome to the PHP team, Pål-Kristian Hamre :) Regards, Philip -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator
Ben Schmidt wrote: $var = $arr['key'] ?? : 'empty'; Also note this is possible with the recent proposal Hannes and I were discussing. It simply looks like $var = $arr?['key'] ?: 'empty'; The ?[ avoids notices and the ?: works as it always has. Ben. If it was going to be ?[, I'd much prefer $arr['key'?]. It was proposed as $arr[?'key'] instead to avoid a backtracking (would that really be noticeable? I'd prefer readibility), but ?[ would have the same problem. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] RFC: built-in web server in CLI.
Greetings Moriyoshi and all, Are people still thinking about this? And how about applying the current/revised patch to trunk thus making it easier to play with and break, but not freeze its features/API yet. Also the wiki is up again so: - RFC: https://wiki.php.net/rfc/builtinwebserver - Patch is here: http://gist.github.com/835698 Regards, Philip -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php