Re: GMP object and is_scalar()
| From: | Yasuo Ohgaki | Date: | Mon, 30 Dec 2013 21:46:07 +0000 |
| Subject: | Re: GMP object and is_scalar() | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70933@lists.php.net to get a copy of this message | ||
Hi Stas,
On Tue, Dec 31, 2013 at 6:35 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> On Tue, Dec 31, 2013 at 6:31 AM, Stas Malyshev <smalyshev@sugarcrm.com>wrote:
>
>> > Since this (GMP numbers work like normal numbers) is new feature, we
>> > may choose better option.
>>
>> I think you're taking it way too far. GMP numbers may support some
>> functions that scalars support, but that does not mean every function -
>> especially functions with are *specifically designed* to distinguish
>> scalars from objects - would do the same thing for them as for scalars.
>> If you're interested in their "numeric" properties - i.e. adding them,
>> multiplying them, etc. - fine, they work that way. But if you "pop the
>> hood" and look inside - no, they should not be scalars inside, because
>> they are not.
>
>
> I agree with your opinion in general.
>
> How about introduce scalar object that is evaluated as scalar?
> It would be useful in user land also.
>
http://www.php.net/manual/en/language.oop5.magic.php
Something like __toScalar(), may be?
--
Yasuo Ohgaki
yohgaki@ohgaki.net