Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77906 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57847 invoked from network); 13 Oct 2014 00:45:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Oct 2014 00:45:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.41 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 209.85.216.41 mail-qa0-f41.google.com Received: from [209.85.216.41] ([209.85.216.41:56248] helo=mail-qa0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 09/70-54452-9B02B345 for ; Sun, 12 Oct 2014 20:45:45 -0400 Received: by mail-qa0-f41.google.com with SMTP id n8so3892619qaq.14 for ; Sun, 12 Oct 2014 17:45:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=PLj1mTu8e6suH/AUCLhceTZxfXFXjmBqkFM8gTJMdfA=; b=vd17Ns2nSJIjwLiZq0DlzX2mTH5sslOWxBlVk1f6OiaiKMVVZ5OsuhBs3qOVUTJ8eA l8vJf5pnJEqH8wPxAb0sVbunarlLF2VmGKXTMZwi/Cpj332GnNkLseV+QqwWo37d4n+z xSyx0vDfAi9PV6XkLQa3UMrnlxT9mgSAneOu1p+fW0RzS2gg8QaMwOudeUayfvl7eQED K+7rpgNu5+ihzRf4tPkMaFJ8+zc1MYRDr4hg6v+pxLdv2FgyJrR6DkADH2QeKHeXOzR8 AOkPi98gnZIh1yHBUolqn7atD8FvJq/4Aan8mDh9oWFYEQH7oAwDs2v4fbRm3/XLiATY mREg== X-Received: by 10.229.7.198 with SMTP id e6mr34934483qce.0.1413161142888; Sun, 12 Oct 2014 17:45:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.97.139 with HTTP; Sun, 12 Oct 2014 17:45:22 -0700 (PDT) In-Reply-To: References: <5439B266.8070300@gmail.com> Date: Mon, 13 Oct 2014 02:45:22 +0200 Message-ID: To: Andrea Faulds Cc: Rowan Collins , PHP Internals List Content-Type: multipart/alternative; boundary=001a1133cdb0eecb680505433770 Subject: Re: [PHP-DEV] Deprecation of func_get_args(), call_user_func_array() and related API From: ocramius@gmail.com (Marco Pivetta) --001a1133cdb0eecb680505433770 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 in > principle they could, eventually, be removed, but I agree with others tha= t > it's far too soon to remove a feature which has been around since 4.0 jus= t > 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 syntax= . > 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 that I've pasted before, then I'm missing some bits of information that may make 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, the= n > surely an included (and C-level) implementation should be sought which ha= s > the better behaviour? > > This matches my own thoughts. There is nothing wrong with these functions= . > There are just some issues with their implementation. We do not need to g= et > rid of the functions, that would be an absurd overreaction. We should jus= t > 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_*` functions, but I assume that I'd only start a giant shitstorm (pardon the wording, but that's the most precise term for that) about performance. Anyway, it's clear that this proposal has short legs, and won't get anywhere in a vote. Greets, Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --001a1133cdb0eecb680505433770--