Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75653 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40255 invoked from network); 17 Jul 2014 07:19:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2014 07:19:53 -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.172 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.220.172 mail-vc0-f172.google.com Received: from [209.85.220.172] ([209.85.220.172:58417] helo=mail-vc0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CB/56-09067-81977C35 for ; Thu, 17 Jul 2014 03:19:53 -0400 Received: by mail-vc0-f172.google.com with SMTP id im17so3805529vcb.17 for ; Thu, 17 Jul 2014 00:19:50 -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=ahb35OHj4F+XbO0bx7VPPSw6XCTcBWRXJAwgyenyZ1E=; b=IIFPQatsJjAx3haSt6tgvVMpQXdecXZ1Lh8rBo/7iF+LrIKt/qdF4GE95f3RqNpJcF b9jK+EfGqsrGVwY4R8w2k20s+xJKNUn1hutnA9FwOkhtpy5UZObiAgN7jGXUe0XqOXoH iW8jgvnp/TxHUf9qf3rfgiKqZUBY281pZPgxTdUGcBEE/3dS0MM1gXHHZaw9JyzVCbcl wnAn3N4tNw9Yu0NZPp1X7XIdixBCIpxxP6ExkuOp1fkFCru5pQ8e+AZN7OPyOXpFcNWV +E4OimlpbebhSPQP7h2KSVESKwgjdM2XEqIuBehXr7u2U33/33QnTmPFZPwymr2jdPgs hJtg== X-Gm-Message-State: ALoCoQnTy4HNRz53EXtoCD4EnMw8Y4nZvtBKI5YbifLBmyv0wKj3qamVJ3IGud6b+uWdyzHShyUUiMjajHgxVXMD2kcQ41tuMCYVziwTLcq4MYo9oAx5y0BFe7eaM+EcqhyQTCXa97WV X-Received: by 10.53.1.231 with SMTP id bj7mr12653482vdd.49.1405581590034; Thu, 17 Jul 2014 00:19:50 -0700 (PDT) References: <7646A8D1-69A2-4255-B048-D3B9F28B422F@ajf.me> <37F89E54-C5B9-4E81-9D1B-660190BDB1FF@ajf.me> <9F08728B-AF74-4098-8D1D-BC21AB821168@ajf.me> <6cb98adf7a217db7530122c98d2f7d02@mail.gmail.com> <28924D84-6571-4AD3-B541-9A2141BBEFCD@ajf.me> In-Reply-To: <28924D84-6571-4AD3-B541-9A2141BBEFCD@ajf.me> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQLLVmCxW2hUorZ722a/IWXk1TMisAK5tnU8AP8mVTsCRfIaXQLN/gGGArG29VECN0oGCQIjGcwDAtRjbbeZFwXLgA== Date: Thu, 17 Jul 2014 10:19:49 +0300 Message-ID: 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 10:09 AM > To: Zeev Suraski > Cc: bishop@php.net; PHP internals > Subject: Re: [PHP-DEV] [RFC] intdiv() > > > On 17 Jul 2014, at 08:02, Zeev Suraski 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