Re: GMP object and is_scalar()
| From: | Yasuo Ohgaki | Date: | Mon, 30 Dec 2013 22:49:51 +0000 |
| Subject: | Re: GMP object and is_scalar() | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70939@lists.php.net to get a copy of this message | ||
Hi Stas,
On Tue, Dec 31, 2013 at 7:20 AM, Stas Malyshev <smalyshev@sugarcrm.com>wrote:
> > Should it? PHP is weakly typed language.
>
> That doesn't mean types do not exist. That means values can be converted
> from type to type, but there's no type "scalar" - it is just a group
> name of a set of types.
>
Agreed on that scalar is name of types which has single value.
> One thing clear to me is users expects GMP numbers behave like
> > scalar numbers most likely.
>
> I don't think users expect anything like that, I don't see legitimate
> use case why users would expect is_scalar return true on GMP object. If
> the user is advanced enough to use is_scalar he should understand what
> that function does. Or user some other function that is more fit for
> their goals.
>
I agree users who know PHP and GMP well would not expect GMP object
is to evaluated as scalar.
I suppose average users would expect/want GMP number as PHP
number also.
> Yet another option for PHP 5.6 is to note GMP numbers as
> > EXPERIMENTAL.
>
> GMP is in PHP for a long time, why would it suddenly become experimental?
Sorry, I meant GMP number arithmetic with normal operators/math functions/
type evaluation functions is better to be considered as EXPERIMENTAL.
It lacks GMP float support and many function won't work as it should be.
(If we consider GMP number as "number" in PHP)
It's safe to note GMP number arithmetic as EXPERIMENTAL and
resolve issues. IMHO.
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net