Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77942 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60565 invoked from network); 13 Oct 2014 21:11:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Oct 2014 21:11:48 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.169 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.169 mail-wi0-f169.google.com Received: from [209.85.212.169] ([209.85.212.169:39098] helo=mail-wi0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A0/A4-32407-3104C345 for ; Mon, 13 Oct 2014 17:11:47 -0400 Received: by mail-wi0-f169.google.com with SMTP id h11so4405258wiw.0 for ; Mon, 13 Oct 2014 14:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=kXuoiJnb6+7By8qgWAQD2K8u3SxXW+yw80/c6/kYu+8=; b=LmSJ+7JMrH2ct81uexXvz55Q3+7c1Pq5d74scOVBKDSayeJu21RmBDadPaAu6drhLo oe5GMYq8zU54iIlFxJebYkWltNz4lSl+QkhLWAGHBbHTtyEljCA8lBJutiQprEj22Htf 7TdNHyqCy351iaAgvbelfr88+k1+qlGArw+utXxoe5X+9/ptvk6tVw0KCPhhR76CGmnZ 7G+kqD/cxVDdSEVEwdgKe3zO59FIS2B+WlmE7/wBawbN1ZarinQbz++gxoFD3HCi8Xec PS5mP03x34lKVMNiDaXY5HbMqwQBe+zKEHOFblW0bC+ER0QjfP6Sv5SpIv9HBPpS3y2W LUxQ== X-Received: by 10.181.8.98 with SMTP id dj2mr1401334wid.70.1413234704775; Mon, 13 Oct 2014 14:11:44 -0700 (PDT) Received: from [192.168.0.2] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by mx.google.com with ESMTPSA id k10sm17918465wjb.28.2014.10.13.14.11.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 Oct 2014 14:11:43 -0700 (PDT) Message-ID: <543C400E.4020603@gmail.com> Date: Mon, 13 Oct 2014 22:11:42 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: PHP Internals List References: <5439B266.8070300@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Deprecation of func_get_args(), call_user_func_array() and related API From: rowan.collins@gmail.com (Rowan Collins) On 13/10/2014 01:45, Marco Pivetta wrote: > 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 think there are a few different ideas here which are worth unpacking. Firstly, no language I can think of has ever been distributed or standardised without a standard library of functions. We all know that the abstractions we use *could* be reimplemented using lower-level structures, but knowing that an implementation is there "out of the box" means we don't need to spend time reinventing the wheel, or learning the subtleties of dozens of competing wheels. Along with syntax and a type system, the standard library is a key part of a language's identity. Secondly, there is the question of "engine magic". I am actually rather sympathetic to the idea that userland code should *be able to* access more of the features that extension code can. For instance, object handlers written in C can implement many more hooks than userland objects can through magic __* methods and SPL interfaces, even when it's not the extension's purpose to manipulate the engine. I'd love it to be *possible* to write a version of SimpleXML in PHP. That said, there are some things which really do need a close integration with the engine to function correctly; variadics support is useful, but it clearly doesn't allow manipulation of the actual parameter passing logic in the way a debug extension might, and nor should it. That does not, however, mean that all code that *can* be written in PHP *should* be written in PHP. High-level abstractions tend to come at a cost to performance, so it makes sense that many parts of a language's standard library are actually written in a lower-level language - in the case of PHP, that means implementing things in C; in the case of C, it might mean implementing them in assembly. Sometimes, too, it just makes more sense to keep everything in one place, such as if an extension is binding to an existing C library, but also provides some unique functions of its own. Finally, there is the question of bundling and maintenance. A function distributed with core will have to be maintained by core developers whatever language it is written in. I guess having a section of the standard library written in PHP might attract more people to contribute to its maintenance, although the likely complexity of such code would probably still be intimidating to many. There's no reason that rewriting it in a different language would automatically make it optional - or that keeping it in C makes it automatically compulsory. PHP already has a modular structure, which distinguishes between mandatory, bundled, and externally maintained "extensions", so if we really wanted a "low fat" PHP we could just make more parts optional. None of this should be taken as argument that anything and everything should remain in the core, but it does add up to a rather higher bar for removals or exclusions than "it's possible to do it another way, so we don't need to include this way". -- Rowan Collins [IMSoP]