Op Fri, 04 Jul 2014 14:34:17 +0200 schreef Robert Stoll <p...@tutteli.ch>:
[Robert Stoll]
I really like how ruby tackles this problem with the syntactic sugar
"unless" which basically is a substitute for "if( !() )".
Maybe we could consider to introduce it in PHP next? It is very natural
to read "unless(is_null($x))" an much nicer than "if(!is_null($x)" IMO.
And it would not only solve your issue with is_null but is_Xy
functions/methods in general.
I think that is just flawless. Thank you SO much for suggesting this.
I don't know how Ruby then handles the alternative condition, but I would
imagine that "unless () {} otherwise {}" would be very sweet.
This is just marvelous. It does indeed solve all the problems. You, we,
won't need any not_null. We won't need any not_anything. With this
addition everything I have said here and more of what I wanted to say,
given enough attention, because I didn't want to finish with something
half-baked, and I really wanted to study this thing more before I made a
final writeup, - everything I have said is voided. Basically. Not
entirely. But almost, yes.
Because you still have the cross-contamination between isset and is_null.
People wrongly use "isset" to test for "is set and is not null". So you
would have to keep is_null as meaning "if it is not set or (if it is set)
it is null".
"unless (is_null())" would then mean "unless (!isset || is_null)" but it
would definitely be better than abusing isset for this.
I really could never have come up with something like this lol. I guess my
mind is too closed from all those years of only using "ifs". This just
breaks everything open. Amazing.
So THANK YOU :D. I still want to do a bigger writeup, but it will take
some time, because I really want to "come to the ice with good irons on"
as they say in Dutch.
So in any case, enjoy the summer (if you are in the Northern hemisphere)
and let's talk again some time.
Bart Schouten, Netherlands.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php