Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119344 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 66652 invoked from network); 19 Jan 2023 10:05:06 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Jan 2023 10:05:06 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CE52B1804F2 for ; Thu, 19 Jan 2023 02:05:05 -0800 (PST) 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_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 138.201.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from swift.blarg.de (swift.blarg.de [138.201.185.127]) by php-smtp4.php.net (Postfix) with ESMTP for ; Thu, 19 Jan 2023 02:05:05 -0800 (PST) Received: from swift.blarg.de (swift.blarg.de [IPv6:2a01:4f8:c17:52a8::2]) (Authenticated sender: max) by swift.blarg.de (Postfix) with ESMTPSA id 43DB841314; Thu, 19 Jan 2023 11:05:04 +0100 (CET) Date: Thu, 19 Jan 2023 11:05:03 +0100 To: Kamil Tekiela Cc: internals@lists.php.net Message-ID: References: <8DA390C5-5E67-4847-A89F-1A8CCC6C5389@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [PHP-DEV] RFC: rules for #include directives From: max+php@blarg.de (Max Kellermann) On 2023/01/18 18:51, Kamil Tekiela wrote: > > #include "zend_portability.h" // for BEGIN_EXTERN_C > What if in future the need for BEGIN_EXTERN_C disappears? Who is going to > remember to update the comment? (I just addressed that concern in reply to Rowan's email.) > As you said yourself, this refactoring has no practical effect on > compilation times. No, I did not say that. I said: "in this early stage, there is no measurable speedup yet" "Once I have disentangled and splitted those fat headers [...], the speedup will be measurable and perceptible." > Another advantage listed is "more correct code". Perhaps it is, but does it > mean that the current situation is likely to cause more frequent PHP bugs? > Would this refactoring help in finding PHP bugs more quicker? This isn't the kind of "correct" that (directly) prevents runtime bugs; it's the kind of "correct" that leads to having more readable code and thus making maintenance easier. If maintenance is easier, developers will likely produce fewer runtime bugs, but that's only an indirect effect. Maintenance becomes easier because it should be easier to find out which header to include to make a certain feature available. Right now, the headers are a big mess - when do I have to include zend.h, when do I have to include php.h and what is php_compat.h, and I included zend_types.h but why are certain types not available? Is there documentation about this? I found none... And PHP extensions I saw look like all people just try'n'error and copy'n'paste to "develop" code. > I mean things like a bug fix using a symbol that hasn't been used in > the file but is included through one of the more generic > headers. Once such a commit is merged into master, it may turn out > that the symbol lacks a new include. This adds unnecessary work for > bug fixers who will now have to verify this and find the appropriate > include during merges. The same can be said about all code changes - all code changes make merging more difficult; sometimes with merge conflicts, sometimes with header changes, sometimes with API changes, and most dangerously: semantic changes. Anyway, you care about the people who merge a bugfix to another branch. Yes, that may sometimes lead to a build problem. Only push a merge commit after you have verified that it builds. Each breakage is extra work. But in return, after the transition to "cleaner code", maintenance and development gets easier. There, you get the time back you invested earlier. Max