> -----Original Message-----
> From: Andrea Faulds [mailto:a...@ajf.me]
> Sent: Thursday, July 17, 2014 9:44 AM
> To: Zeev Suraski
> Cc: bis...@php.net; PHP internals
> Subject: Re: [PHP-DEV] [RFC] intdiv()
>
>
> On 17 Jul 2014, at 07:29, Zeev Suraski <z...@zend.com> wrote:
>
> > From debating whether it's worth it to add a new function for an
> > not-so-commonly-used-operation-to-say-the-least, we're now seriously
> > considering adding a new language level operator?  Really?
>
> Is it *really* not that common? I can think of several use-cases off the
top of
> my head:
>
> * Time (actually pretty common in web apps, though we have a DateTime
> class)
> * Splitting into rows and columns
> * Pagination
> * Currency (you can't, for example, represent the full number of BTC in
> circulation in BTC's base unit without using an integer of beyond
53-bits, and
> it's common practise to use *fixed-point* arithmetic here)
> * Nearest-neighbour scaling
> * Most likely other ones (these are just what I thought of immediately)

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.

I think the RFC should mention that it's already possible to do it using
bcmath or gmp;  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.

> Also, while ** is great for some applications, it's not going to be used
much by
> others. Is the same not true of an integer division operator?

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...

Zeev

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

Reply via email to