> -----Original Message-----
> From: Andrea Faulds [mailto:a...@ajf.me]
> Sent: Thursday, July 17, 2014 10:09 AM
> To: Zeev Suraski
> Cc: bis...@php.net; PHP internals
> Subject: Re: [PHP-DEV] [RFC] intdiv()
>
>
> On 17 Jul 2014, at 08:02, Zeev Suraski <z...@zend.com> wrote:
>
> > I think it is, given I believe it's the first time people are asking
> > for this after PHP's been out for almost two decades...
> > As the RFC itself suggests, you can use the current division for most
> > use cases, including the ones mentioned above - they'd work in the
> > vast majority of cases.
>
> Yes, but as previously mentioned, beyond 2^52 it breaks down. What's
more
> worrying is the code out there written by people obviously unaware of
this,
> but I shouldn't use MtGox's incompetence as a reason to fix PHP ;)
>
> > I think the RFC should mention that it's already possible to do it
> > using bcmath or gmp;
>
> It's not possible to do with bcmath or gmp within the brief of "find the
> quotient of the division of two longs without requiring an extension".
Neither
> bcmath nor gmp is core PHP, and neither operate on longs, though you can
be
> silly and convert a long to a string, in bcmath's case, or a gmp object,
in gmp's
> case, then do the operation, then convert back, checking for the two
failure
> cases, of course.


It's still possible to do.  When people vote on a new feature the full
context should be clear.  Again, I'm supporting your RFC (in its original
form at least) - but we should provide as much information as possible in
the RFC to give voters the full context.

> > That said, I tend to agree that we should have something like that in
> > ext/standard, so I'm actually in favor of doing it - just not as an
> > operator.
>
> Well, that's better than nothing I suppose, but I'd still rather use
something
> infix.

PHP's not Perl.  Let's keep it that way please...

> > To be honest, that operator was simply copied verbatim from Perl, back
> > in the day when Perl ruled the Web world and minimizing the learning
> > curve for Perl developers was an important goal.  Not sure if we'd add
> > it to the language had we not 'plagiarized' it from Perl.
>
> Huh? ** was added by an RFC this year. Actually, since 5.6 isn't out
yet, it's
> technically not part of PHP yet...

OK, this RFC passed well under my radar.  I thought we had it forever, and
indeed I never found a reason to use it :)  I'd probably vote against it
if I was aware of it, but given it's common in other languages, I wouldn't
have strongly opposed it.  I don't think it makes sense to add a
specialized integer division operator when we do have a different division
operator, and I don't think other dynamic languages have such an operator
- so unlike **, there's no established precedent...

Zeev

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to