Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75646 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28464 invoked from network); 17 Jul 2014 06:44:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2014 06:44:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.207 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.207 imap2-2.ox.privateemail.com Received: from [192.64.116.207] ([192.64.116.207:35172] helo=imap2-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 44/C3-09067-FB077C35 for ; Thu, 17 Jul 2014 02:44:16 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id A1FF68C007D; Thu, 17 Jul 2014 02:44:12 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap2.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap2.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id TYFbGLhT8iG0; Thu, 17 Jul 2014 02:44:12 -0400 (EDT) Received: from [192.168.0.15] (unknown [90.210.122.167]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 0E36C8C007B; Thu, 17 Jul 2014 02:44:10 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: Date: Thu, 17 Jul 2014 07:44:07 +0100 Cc: bishop@php.net, PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <9F08728B-AF74-4098-8D1D-BC21AB821168@ajf.me> References: <7646A8D1-69A2-4255-B048-D3B9F28B422F@ajf.me> <37F89E54-C5B9-4E81-9D1B-660190BDB1FF@ajf.me> To: Zeev Suraski X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] [RFC] intdiv() From: ajf@ajf.me (Andrea Faulds) On 17 Jul 2014, at 07:29, Zeev Suraski wrote: > =46rom 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=92t, 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=92s common practise to use *fixed-point* arithmetic = here) * Nearest-neighbour scaling * Most likely other ones (these are just what I thought of immediately) Also, while ** is great for some applications, it=92s not going to be = used much by others. Is the same not true of an integer division = operator? On 17 Jul 2014, at 07:31, Zeev Suraski wrote: > I can't believe we're seriously considering adding an operator for = something > so uncommon. >=20 > I'm actually in favor of adding APIs, but absolutely not an obscure > operator. We're not Perl. Nor are we Python, but it is worth looking at just how many other = languages support this considering it=92s actually very useful in some = situations. I can think of C, C++, C#, Java, Objective-C, Visual Basic, = Pascal, Python and Ruby to name a few popular ones. If you say that some = of these implement it just because C does, I=92m not sure that=92s fair, = as there are plenty of bad ideas in C which these don=92t implement. -- Andrea Faulds http://ajf.me/