Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75650 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35143 invoked from network); 17 Jul 2014 07:02:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2014 07:02:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=zeev@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=zeev@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.182 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.220.182 mail-vc0-f182.google.com Received: from [209.85.220.182] ([209.85.220.182:45719] helo=mail-vc0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/45-09067-CF477C35 for ; Thu, 17 Jul 2014 03:02:23 -0400 Received: by mail-vc0-f182.google.com with SMTP id hy4so3839752vcb.27 for ; Thu, 17 Jul 2014 00:02:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:references:in-reply-to:mime-version :thread-index:date:message-id:subject:to:cc:content-type; bh=QslEI5ACBJmqZUiBV8aTqNDbGeVBrFkOsEaVZ3VbSUw=; b=kkiNriDQVTma9X/4SBep87v8VAHXaojf2465XMLawQgjbT9T1VbWfAf2llAeyJ9hbW sqJSzUABAs94QmVYlswDrH4TSH8jWMEY86wVhWyCBxOk04sx1GNB6W3fuDD6zAQknHmV 9lgdmKRGtZs94PjlezxWwl+Ckf/VEk9zBJOSkW1F8giT7ajz2ZtKYaOHq20a/1KTqopi reqIHGilQIFfzDjIG1GG7s2s6y61136EAJoVzfIbDPAmo/iVU+TdYmbmWQrF26KBjad4 TWoLbk0oCgQBGy/d3lv3BEgHaojgweeebfKlKrx8ZMKoe87cEgd0/Mg6g7N9TL2Ss5WR edDQ== X-Gm-Message-State: ALoCoQkqelsAMsw99oK6DAtINtKgIkduOtDwzfKv+nG0QT9G1OuurRZdNguOJE0MIXoNF3N//5d+3RvXxiW07B7ZfKqQ1JgqSSUti0Z83FyZgZaQgPOf6lj+Oa6+CRT8ljHAplX8xj99 X-Received: by 10.53.5.162 with SMTP id cn2mr14150252vdd.23.1405580537842; Thu, 17 Jul 2014 00:02:17 -0700 (PDT) References: <7646A8D1-69A2-4255-B048-D3B9F28B422F@ajf.me> <37F89E54-C5B9-4E81-9D1B-660190BDB1FF@ajf.me> <9F08728B-AF74-4098-8D1D-BC21AB821168@ajf.me> In-Reply-To: <9F08728B-AF74-4098-8D1D-BC21AB821168@ajf.me> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQLLVmCxW2hUorZ722a/IWXk1TMisAK5tnU8AP8mVTsCRfIaXQLN/gGGArG29VECN0oGCZk+ugQQ Date: Thu, 17 Jul 2014 10:02:17 +0300 Message-ID: <6cb98adf7a217db7530122c98d2f7d02@mail.gmail.com> To: Andrea Faulds Cc: bishop@php.net, PHP internals Content-Type: text/plain; charset=UTF-8 Subject: RE: [PHP-DEV] [RFC] intdiv() From: zeev@zend.com (Zeev Suraski) > -----Original Message----- > From: Andrea Faulds [mailto:ajf@ajf.me] > Sent: Thursday, July 17, 2014 9:44 AM > To: Zeev Suraski > Cc: bishop@php.net; PHP internals > Subject: Re: [PHP-DEV] [RFC] intdiv() > > > On 17 Jul 2014, at 07:29, Zeev Suraski 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