Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75252 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75958 invoked from network); 4 Jul 2014 20:27:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jul 2014 20:27:36 -0000 Authentication-Results: pb1.pair.com header.from=xen@dds.nl; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=xen@dds.nl; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain dds.nl from 85.17.251.144 cause and error) X-PHP-List-Original-Sender: xen@dds.nl X-Host-Fingerprint: 85.17.251.144 smtp.dds.nl Linux 2.6 Received: from [85.17.251.144] ([85.17.251.144:56072] helo=montblanc.dds.nl) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 02/80-00852-63E07B35 for ; Fri, 04 Jul 2014 16:27:35 -0400 Received: from xen-netbook.arnhem.chello.nl (dhcp-077-249-176-227.chello.nl [77.249.176.227]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by montblanc.dds.nl (Postfix) with ESMTPSA id D80446E0714 for ; Fri, 4 Jul 2014 22:14:46 +0200 (CEST) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: internals@lists.php.net References: <002b01cf9784$4c1fe670$e45fb350$@tutteli.ch> Date: Fri, 04 Jul 2014 22:27:27 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Message-ID: In-Reply-To: <002b01cf9784$4c1fe670$e45fb350$@tutteli.ch> User-Agent: Opera Mail/1.0 (Win32) X-Virus-Scanned: clamav-milter 0.97.8 at montblanc X-Virus-Status: Clean Subject: Re: [PHP-DEV] not_null function From: xen@dds.nl (Xen) Op Fri, 04 Jul 2014 14:34:17 +0200 schreef Robert Stoll : > [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.