Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103873 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 64104 invoked from network); 29 Jan 2019 03:34:06 -0000 Received: from unknown (HELO mail-ua1-f44.google.com) (209.85.222.44) by pb1.pair.com with SMTP; 29 Jan 2019 03:34:06 -0000 Received: by mail-ua1-f44.google.com with SMTP id c24so6277033uak.1 for ; Mon, 28 Jan 2019 16:13:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DC0N9VYUKRB1Pmirc4j8gCi4LtyhdnPQDoyNrzb09Mk=; b=WcARJ6WmY1KVizDlVhDwWQrsKpOagcs2aMhvH1EuiFURtkTvHzLFMF6GqD3EADSmkF QNGrce1zPILE5tyJPJ4e9eiZ3Gi2GfSOXf2NxcxwCJ3Pe32JEheHHsTs3ynstI2DpT0p pV4QaxYwyWqwOSRaINZpnUsWam1TtU7JW1v7ssY3EXXOKHE4LwRH0QfmIZeMV4bMSCer iBjknVAq4M4fT/QvDgT1fbJCiCP0DYKQaZy0EA5zJ6Kh5V98nR4gEvPbbUvMMhlTmjZr IHVgLZzLcEbH+FeL5vzfL+GTMIoxooP8kPJC+9ayj5G8CSJ/MqP0SmkCZ/46zMj6muEd /5UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DC0N9VYUKRB1Pmirc4j8gCi4LtyhdnPQDoyNrzb09Mk=; b=CZKfqQ3a2HuRTlPKSSDMNNSgvJqMOLu2y4b95qSqmi67lfGoNja3WfposkWzLKgu2L oioesUnvdQj9WxR+QKCnpXlspDGqw/QM3mN5iHn4Wr396sU7+WdMhK/JnWM/ffEqy3Yx ix9vkCB4bgCKVlrnz4E4o7wofU6O3GQxaYLW403qLt81WdvREa5RR/nrhhgrpt9oBnh8 5hM64oBJrX2OZFLjc2r4OlFGVWfkOeVIWgwrOJubdFJG2samc7I0nvRqgQ6ApHHZIm7b lUin6QrioY1z8irU2h7YRiPIp+OLM7AZ2LyFbj7yGvPImiJkmgjZO/99ll/TBTFZ+OQB sOCw== X-Gm-Message-State: AJcUukeXo4os/DM0ZAkKbBmK8GS4NvRc/AduoC8MgVNWLzlt8mlxwvG5 RfM6TnHpPc2Aox7lvvGUWfx9Z0jUNEZefc5CPXg= X-Google-Smtp-Source: ALg8bN4k7yDQFgXar36y0umGSBXiBMv9TqI4DK2GxDV+Cl7Dq3iDa+3n3iEae0y3fDLZTKTS6MwlmiGEjIy8z+u1S78= X-Received: by 2002:ab0:16c8:: with SMTP id g8mr10175495uaf.60.1548720801249; Mon, 28 Jan 2019 16:13:21 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 29 Jan 2019 01:13:05 +0100 Message-ID: To: Dan Ackroyd Cc: Rowan Collins , Benjamin Morel , Thomas Hruska , PHP Internals Content-Type: multipart/alternative; boundary="00000000000036fd5b05808da9bb" Subject: Re: [PHP-DEV] Deprecation ideas for PHP 8 From: george.banyard@gmail.com (Girgias) --00000000000036fd5b05808da9bb Content-Type: text/plain; charset="UTF-8" On Thu, 24 Jan 2019 at 01:25, Dan Ackroyd wrote: > On Wed, 23 Jan 2019 at 17:25, Girgias wrote: > > > I understand the rationale for functional programming, may I ask > > in your opinion should PHP have built-in functions for arithmetic > > operations so that it can be used in such a way without needing userland > > implementations? > > No, but only I'd much strongly prefer we have some syntax for defined > 'short closures' ala Javascript: > > $values = [1, 2, 3]; > $bar = array_map($x => $x + 1, $values); > > // $values === [2, 3, 4]; > > as those cover much more than the basic arithmetic operations, are > nice and readable after you've used them a few times. > > cheers > Dan > Ack > I didn't even know you could omit parenthesis in JS closures, the more you know. But it seems like there is already a Draft for an RFC for short closures in PHP but that one seems to have come to a halt. I've realised I didn't go through array functions so just gonna bring them up for the sake of not creating a new thread: - key_exist - alias of array_key_exist A GitHub search brings up 276 078 results where there are some userland usage but also a whole lot of unit tests usage https://github.com/search?l=PHP&p=1&q=key_exists&type=Code - pos - alias for current Can't seem to get any meaningful result by searching on GitHub as it picks up more or less anything which contains pos https://github.com/search?l=PHP&q=pos%28&type=Code - sizeof - alias of count A Github search brings up 1 617 789 results with lots of userland usage but also a bit of unit testing https://github.com/search?l=PHP&p=1&q=sizeof&type=Code And then there is *array_multisort* a function which has a signature which isn't even possible in userland code. (https://secure.php.net/manual/en/function.array-multisort.php). Other than the fact that this function's documentation isn't totally correct in my opinion I did a Github search to see if people use it. From what I've seen in the search results [1], around 620k, it is only used in phpt unit tests and a unit test of a parser. Now, I don't think a function which doesn't follow normal function signature converntion (or isn't even possible) shouldn't really be part of the language. Moreso that it seems barely anybody uses it. What's people opinion on deprecating array_multisort ? [1] https://github.com/search?l=PHP&o=desc&p=1&q=array_multisort&s=&type=Code George P. Banyard --00000000000036fd5b05808da9bb--