Andrea Faulds wrote on 16.09.2014 20:34:
Quoted text · 8 lines
+1 on ?? — there's precedent for it, and it means we don't have to explain why the shorthand form of an operator behaves differently to the long form, which is just going to confuse users.
After a 2nd look I have to agree here too. Changing behavior in something so widely used as the current operator will likely create more pains. A new operator, clearly documented, sounds much cleaner, even more as it does something different anyway.
By popular demand, I’ve changed the RFC to instead propose a ?? operator, after Nikita Popov generously donated a working ?? patch. In doing so, the RFC is renamed “Null Coalesce Operator”.
Please read it: https://wiki.php.net/rfc/isset_ternary
Thanks!
Andrea Faulds
http://ajf.me/--
looks good!
What are the pros and cons of a new operator vs. a new function? For example, MySQL has a coalesce() function: http://dev.mysql.com/doc/refman/5.6/en/comparison-operators.html#function_coalesce
Regards,
Thomas
What are the pros and cons of a new operator vs. a new function? For example, MySQL has a coalesce() function: http://dev.mysql.com/doc/refman/5.6/en/comparison-operators.html#function_coalesce
A function is useless as it wouldn’t stop you getting E_NOTICEs.
--
Andrea Faulds
http://ajf.me/
Sorry, I mean to implement coalesce() as a token like isset() ?
Regards,
Thomas
Andrea Faulds wrote on 16.09.2014 21:30:
Quoted text · 6 lines
What are the pros and cons of a new operator vs. a new function? For example, MySQL has a coalesce() function:
http://dev.mysql.com/doc/refman/5.6/en/comparison-operators.html#function_coalesceA function is useless as it wouldn’t stop you getting E_NOTICEs.
--
Andrea Faulds
http://ajf.me/