Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77930 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28544 invoked from network); 13 Oct 2014 15:48:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Oct 2014 15:48:22 -0000 Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.172 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.216.172 mail-qc0-f172.google.com Received: from [209.85.216.172] ([209.85.216.172:61160] helo=mail-qc0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1A/63-11151-544FB345 for ; Mon, 13 Oct 2014 11:48:22 -0400 Received: by mail-qc0-f172.google.com with SMTP id o8so5298787qcw.3 for ; Mon, 13 Oct 2014 08:48:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=Qqdq1AbS5xZsRjnv8lWm1lssqc7w1Hrl13lf5BagoCs=; b=riMWuhb5ufSyRsu2tQ0btDHaBnqADCrlISTIGfkSmeAGOauTeRQlrBnYvyqvEXFBVZ 4VxNsc25M79AQHgzHt0NJYNrSvuF1CV+0WKEUl8tqMYOC08aGflt9ocS92X/Y4AAMW4u aScHvb05epBs1sh7kJOTT1UfvbeqUgXN9rnxCKQ+rbb+bLgIc4M4b0PGxnuP/2XZ1gX+ 4rVAZTme3yGjKkPFxchj2gXvYuqBpaMylCpm9O5gJGRAL3UhZmuOKJkZuMBkr3c8cgFt qY2+R6cEPtIUfg86+FCA9vgCMhPjmguuF5ibpvB332Qv2wUEIXolodjl87yEZNaokdjS tg4w== X-Received: by 10.140.16.207 with SMTP id 73mr40758015qgb.105.1413215299285; Mon, 13 Oct 2014 08:48:19 -0700 (PDT) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.140.101.172 with HTTP; Mon, 13 Oct 2014 08:47:39 -0700 (PDT) In-Reply-To: References: <5439B266.8070300@gmail.com> Date: Mon, 13 Oct 2014 17:47:39 +0200 X-Google-Sender-Auth: rMnfD488t5UgtA75LU1RqVFvzyM Message-ID: To: Marco Pivetta Cc: Andrea Faulds , Rowan Collins , PHP Internals List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Deprecation of func_get_args(), call_user_func_array() and related API From: jpauli@php.net (Julien Pauli) On Mon, Oct 13, 2014 at 2:45 AM, Marco Pivetta wrote: > On 12 October 2014 00:47, Andrea Faulds wrote: > >> >> On 11 Oct 2014, at 23:42, Rowan Collins wrote: >> >> > func_get_args() and func_num_args(), OTOH, existed solely to support >> variadics, and anything taking advantage of them being functions rather >> than a language structure would have to be quite exotic and arcane, so i= n >> principle they could, eventually, be removed, but I agree with others th= at >> it's far too soon to remove a feature which has been around since 4.0 ju= st >> becuase 5.6 includes a better alternative. >> >> They have some (admittedly limited) use beyond variadics. If you make a >> function and later make it redirect to another, you can preserve your >> typehints by using func_get_args() rather than using the =E2=80=A6 synta= x. >> > > Can anyone come up with those use-cases? If there is something that > `func_get_args()` can do and that can't be done with the code examples th= at > I've pasted before, then I'm missing some bits of information that may ma= ke > the entire proposal moot. > > >> > If they're included in the core distribution, then why make them >> optional at all? If it's just a question of how the functions behave, th= en >> surely an included (and C-level) implementation should be sought which h= as >> the better behaviour? >> >> This matches my own thoughts. There is nothing wrong with these function= s. >> There are just some issues with their implementation. We do not need to = get >> rid of the functions, that would be an absurd overreaction. We should ju= st >> fix the implementations. > > > The point is removing more API from core and moving it to userland. > API implemented in core needs to be maintained by core devs, and is > non-transparent to consumers (reflection/debugging/etc). > In general, I've always been against any non-language feature that isn't > implemented with the language itself, but it's my point of view: as a > simple rule of thumb (my rule, many would just say I'm crazy), if it can = be > implemented in PHP, then don't add it to core or extensions. > I would suggest the same deprecation approach for many `array_*` function= s, > but I assume that I'd only start a giant shitstorm (pardon the wording, b= ut > that's the most precise term for that) about performance. Yep, rewriting array_ functions in PHP will hit a very huge VM overhead and drop the function's performance dramatically. For func_get_args() and call_user_func() , we could add a deprecation notice to PHP7 to tell people there are "better" ways of doing this now. Julien.P