Re: [RFC DISCUSSION] typeof
| From: | Rasmus Schultz | Date: | Sun, 05 Jun 2016 11:50:53 +0000 |
| Subject: | Re: [RFC DISCUSSION] typeof | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-93811@lists.php.net to get a copy of this message | ||
> So let's add more of it by having multiple functions that do exactly the same
thing but name null and float differently.
It's a point of view, that's all.
You can choose your point of view - I choose the point of view where we
replace a broken function with a function that does what developers would
actually *expect*.
You know what, all this rhetoric in favor of inconsistency, against a
solution that has already been implemented?
I don't know how to participate in this.
On Sun, Jun 5, 2016 at 12:36 AM, Stanislav Malyshev <smalyshev@gmail.com>
wrote:
> Hi!
>
> > The old function is actively causing confusion - the reported type-names
> > aren't even inconsistent with scalar type-hints, and then you have to go
> > and read the manual with some explanation about historical reasons why
> > the function doesn't work like you'd expect.
>
> Why it should match scalar types? You can't use output of this function
> in a scalar type in any way.
>
> > PHP is infamous for these surprise moments.
>
> So let's add more of it by having multiple functions that do exactly the
> same thing but name null and float differently.
>
> > I think that gettype() should be deprecated in favor of a new function
> > that actually makes sense.
>
> If you think people would want to edit gigabytes of existing code
> because you want NULL to be lowercase, you are very seriously mistaken
> about the order of priority of an average PHP developer. I am sure
> 99.9999% of people care about all this pedantry infinitely less than
> they care about their code keeping working and their development not be
> impeded by things like having to read the manual each time to choose
> which two of almost identical functions they need now and which of them
> has null in which case.
>
> > I think that deprecating and fixing things is long-term less confusing
> > than documenting your way around legacy functions that produce
> > surprising and confusing results.
>
> I think constantly disrupting the language environment by pedantic
> tweaks that add BC and cognitive load but do not actually enable
> anything new, just move things around - is not only confusing, but
> harmful for the whole ecosystem.
>
> And if "NULL" really confuses you to the point you have no idea what it
> means - well, really, I don't know what to say.
>
> --
> Stas Malyshev
> smalyshev@gmail.com
>