Re: Adding "numeric" type hint
| From: | Yasuo Ohgaki | Date: | Wed, 29 Apr 2015 21:39:16 +0000 |
| Subject: | Re: Adding "numeric" type hint | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86033@lists.php.net to get a copy of this message | ||
Hi Christoph,
On Thu, Apr 30, 2015 at 6:27 AM, Christoph Becker <cmbecker69@gmx.de> wrote:
> > On Wed, Apr 29, 2015 at 9:33 AM, Ryan Pallas <derokorian@gmail.com>
> wrote:
> >
> >> I agree with Stanislav here, if you want to accept any type of number,
> its
> >> easy enough to add your own checking to do that with the wonderful
> >> is_numeric. And for simplicity, make an invalidArgument method that you
> can
> >> call after manually checking if arguments are wrong: *
> http://3v4l.org/r0qO0
> >> <http://3v4l.org/r0qO0>* Works for all versions
> >> this tool runs as well.
> >
> > The issue is that weak mode type hint is *not* weak at all. It forces to
> > have
> > machine native type rather than it's data form.
>
> A solution for this issue has been proposed by the "Big Integer Support"
> RFC which has been withdrawn. It's too late for PHP 7.0 to re-open it,
> but it might be reasonable to to so for PHP 7.1.
I don't think breaking a lot of code under 32 bit machines with PHP 7.0
is not good thing to do.
In addition, current code does not even allow GMP object as "int".
http://3v4l.org/GiklL
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net