Re: [RFC][DRAFT] GMP number as PHP number
On Tue, Dec 31, 2013 at 12:44 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> Hi all,
>
> There has been GMP number discussion and made draft RFC for it.
> Please comment so that I can add more to the RFC.
>
> Thank you.
>
RE empty(): There is nothing special that needs to be done to implement
this. To support empty() one simply has to implement the IS_BOOL cast. The
reason I haven't implemented it in the first place is the common C++
programmer wisdom that you should never, ever overload the bool operator
without using the safe bool idiom or an explicit operator (both not
available in PHP, of course). But given that I already have GMP to string,
double and int conversions implemented, it doesn't seem entirely
unreasonable to also allow checking for GMP(0) via !$gmpNum as well. If the
general opinion is that we want this behavior, I can add it.
Nikita
Thread (9 messages)