Re: not_null function
| From: | Kris Craig | Date: | Fri, 04 Jul 2014 09:08:26 +0000 |
| Subject: | Re: not_null function | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75247@lists.php.net to get a copy of this message | ||
On Fri, Jul 4, 2014 at 12:57 AM, Mats Lindh <mats.lindh@gmail.com> wrote:
> On Fri, Jul 4, 2014 at 9:43 AM, Kris Craig <kris.craig@gmail.com> wrote:
>
>> What would be wrong with changing it from a function to a language
>> construct like isset() and empty()? If is_null() were the equivalent of
>> !isset( $var ) || $var === NULL, it would make a hell of a lot more sense
>> than what's there now.
>>
>
> So your suggestion is to make it _exactly_ like isset?
>
No, isset() returns TRUE if a variable exists and is not NULL. So
technically, my suggestion is to make it exactly the opposite of isset().
But now that I think of it, having is_null() essentially duplicate
!isset() instead of duplicating === NULL wouldn't make it any more
worthwhile.
I guess I wouldn't object so much if the performance loss could be
mitigated somehow. I don't mind having questionable aliases floating
around for convenience (like with what Peter mentioned regarding
callbacks), so long as they don't introduce a drag on performance. It's
that completely unnecessary perf hit that troubles me.
--Kris