Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110208 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 38346 invoked from network); 19 May 2020 01:45:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 May 2020 01:45:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2D1991804E4 for ; Mon, 18 May 2020 17:23:48 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS31103 84.19.160.0/19 X-Spam-Virus: No X-Envelope-From: Received: from mail.toneristzuen.de (mail.toneristzuen.de [84.19.169.162]) by php-smtp4.php.net (Postfix) with ESMTP for ; Mon, 18 May 2020 17:23:47 -0700 (PDT) Received: from maniacmansion.fritz.box (ppp-188-174-52-194.dynamic.mnet-online.de [188.174.52.194]) by mail.toneristzuen.de (Postfix) with ESMTPSA id 92BD34A6DE; Tue, 19 May 2020 02:23:45 +0200 (CEST) Message-ID: To: Jakob Givoni , Arnold Daniels Cc: Dan Ackroyd , php internals Date: Tue, 19 May 2020 02:23:44 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] SPL development interest From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Sat, 2020-05-16 at 16:37 +0200, Jakob Givoni wrote: > The reason I was wondering about it was mostly for understanding > where > one would put Classes, Interfaces and Traits that should be essential > parts of the language. > F.ex. it seems the Countable interface should have been in the core > together with Traversable and Serializable, especially since count() > knows about Countable and is part of the core. > > It seems there are only 3 classes that are part of the core: Closure, > Generator and WeakReference. > And no traits, right? Not sure what "the core" might be. Where code lives has a few technical arguments, but also some mindset of the developer aspects. Some aspects, sometimes anecdotally: * Anything in Zend/ may not directly depend on anything elsewhere. In the past there was even a buildsystem maintained so one could do `cd Zend; ./buildconf; ./configure; make` and then had a libzend.so for whatever purpose, but that was removed "recently" - https://github.com/php/php-src/blob/PHP-7.3/Zend/buildconf is gone in master) * In consequence anything language related like Closure has to live in Zend/ (the engine must be able to create those when seeing related syntax) * If it can live elsewhere, probably it should * ext/standard is the classic anything which goes nowhere else" * main/ has a few things, mostly stream related, but usually should have more the glues and internals than "directly" called code * ext/spl was to large parts helly's playground for more object oriented and functional things * If a feature is a bit larger it can be good to encapsle it, for instance json_encode and json_decode could live in ext/standard but since it's quite a bit of code separating in it's own extension makes sense * ext/json being possible to be disable means that other extensions can't rely on it being there to 100% * Similar historically date routines had been in ext/standard but when Derick created the new Date classes this was so much, that splitting of made sense * Reflection initially lived in Zend/ as it gives out quite some engine details, however write access to the engine is kept a bit more restricted than elsewhere and when I sent too many patches helly at some point decided to move it from Zend/ to ext/reflection so I could directly commit ( https://github.com/php/php-src/commit/7cb0480d0 ) johannes