On 10/07/2018 20:11, Kalle Sommer Nielsen wrote:
Den tir. 10. jul. 2018 kl. 21.08 skrev David Rodrigues <david.pro...@gmail.com>:
I think that "or" could be removed if PHP could supports inline conditionals 
like:

die() if !$connected;
throw Exception() if fail();
$x = $y if (z() && w());

Or "when": die() when !$connected;

It seems more clear than $connected or die().
I in fact find that more unreadable as you first got to dig through
the error handling before you actually get to the logic that triggered
it.


A more readable syntax, if we were designing from scratch, might be to look at SmallTalk, where ifTrue and ifFalse are methods on the boolean class, so can appear post-fix after any boolean, giving you something like:

$connected ifFalse: die();


Regards,

--
Rowan Collins
[IMSoP]


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to