Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93646 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26889 invoked from network); 31 May 2016 02:14:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 May 2016 02:14:33 -0000 Authentication-Results: pb1.pair.com smtp.mail=colinodell@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=colinodell@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.44 as permitted sender) X-PHP-List-Original-Sender: colinodell@gmail.com X-Host-Fingerprint: 209.85.218.44 mail-oi0-f44.google.com Received: from [209.85.218.44] ([209.85.218.44:36467] helo=mail-oi0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A0/E4-26200-883FC475 for ; Mon, 30 May 2016 22:14:33 -0400 Received: by mail-oi0-f44.google.com with SMTP id j1so285488148oih.3 for ; Mon, 30 May 2016 19:14:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9s5w1MjSaTMkJplTFW1G0ImuP7EfjCHhlYPyDwd2Pys=; b=ttpfOSd9dJY+82dhcbmH2JrccqW3+3QgoFmNHtH7PciWp6IYxAOYlcUp5yv+keCZTQ /r5cXnElbth1DoB78ZhMlk8ZHImMKjxkEVFguFsFBGTUhz6Jms7ccSvkU2iNB7PwcENH 9eBLhZ5fIy1VpnvCftb5uujm/0bppBBLFeiMc/Y97y+KdXvbKK+ad82/18Q4Y4wD4OD9 8Ui/BEFz0VKSuEik8xSa7lprIXdAP/f3twc7VLNtGTxDeiWm0ybNgHzoAXvXrvgzEkSK ZFVsT4Cs/n6qF8CNgRbqGGN2MmN7IfDfnGitrLlPBPXtgTq5CsbsT6+G5+PQgajkCElI Ts5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9s5w1MjSaTMkJplTFW1G0ImuP7EfjCHhlYPyDwd2Pys=; b=AwpjlQaEmufvAg2/Gas3uEVm6nQ/tLbLb4rJ0cSYu+tiuHedKwj9Ek4b77q2TIY3Li qD8Bi++Ay5lpzhN6VDzv//KnrZSe2z1RwbkYiMJw86bKvrK5GK0iTqXyp3rz/7GTfA8M YkKymzv1puqSQITcuSRAy2eANe/Nay1hFei10msLh0+djQPe/ngjvICby2EcBku+md0R gMFV1H9YUcBE+4fHlL9clmTw2PR5aU/xrHJjZ/yGjKMknkr9i7ASq5pvk4Kn1/UTBePI Bs9KW9DNi1i2Q/Lc4D6Sj7tJ7oM8rYI8MhAKUo9AGm4HrWkLxmgTd6b/9dJ4ZOt5ZtBF 2AKQ== X-Gm-Message-State: ALyK8tKRR0cEdaPnCOiMVo6V4iODcuVqBsnBaWSY5wcLPYAWEzbioaBuHWNh47ucNN4ujAsyz+VcUgNrhjWDKQ== X-Received: by 10.157.20.202 with SMTP id r10mr20194447otr.59.1464660869916; Mon, 30 May 2016 19:14:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 31 May 2016 02:14:20 +0000 Message-ID: To: Marco Pivetta Cc: PHP Internals , Jeremy Mikola Content-Type: multipart/alternative; boundary=001a1140fd20de2c8a053419eecc Subject: Re: [PHP-DEV] [RFC Discussion] array_change_keys() From: colinodell@gmail.com ("Colin O'Dell") --001a1140fd20de2c8a053419eecc Content-Type: text/plain; charset=UTF-8 > > Ported to https://github.com/Ocramius/array_change_keys-benchmark, thanks! > I've updated the RFC's benchmarks based on your tool. They confirm that array_change_keys is faster than array_combine but slower than foreach (in most cases). Thanks for helping with this! > No, but I really don't care about the other functions. If something > doesn't support a `Traversable` in today's jungle of Generators and > asynchronous processing. > While generators and async processing are nice, I don't think that means we have to avoid work that doesn't fall under that umbrella. Or Is there perhaps something unique about this particular function that warrants Traversable support whereas other functions don't? > 3. Purpose of the array_*() function is immediately obvious. >> > > Disagree, as mentioned in few edge cases in other responses (something > about numerical keys, IIRC: can't find the actual reply) > I believe you're referring to the questions about returning null, invalid, or duplicate keys. As I mentioned in my responses to those questions, array_change_keys() was expressly designed to behave *EXACTLY* like existing functions (such as array_flip): - Returning null as a key is not allowed (array_flip disallows this). - If you return a duplicate key, only the last value to return it will be kept (just like calling array_flip with duplicate values or running: $arr['foo'] = 1; $arr['foo'] = 2;) Somebody else asked whether they could "return null" to use an automatic numeric key - I responded "no" because "$arr[null]" is not the same as "$arr[]". *Again, this RFC does NOT introduce any new edge cases or quirks.* I'd therefore respectfully ask that you re-consider this. > Function composition can be applied also with a userland implementation. > My main issue with this is that it doesn't need to exist in *core*. Doesn't > mean that it can't exist in userland ;-) > One could argue that array_change_key_case(), array_column(), random_int(), password_hash(), and others don't strictly need to exist in core either. However, they were all included because someone (or some group) felt that they provided enough value to PHP developers and/or that their usefulness outweighed the hassle of a userland implementation. All I ask is that we give this RFC the same consideration - and if you still feel the same I fully accept that :) I appreciate the feedback as always and have updated the RFC with several of these discussion points. Colin --001a1140fd20de2c8a053419eecc--