Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121178 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 30942 invoked from network); 29 Sep 2023 17:13:29 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Sep 2023 17:13:29 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2BB8F18004A for ; Fri, 29 Sep 2023 10:13:28 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 176.9.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 29 Sep 2023 10:13:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1696007606; bh=4J10fFw7P3fgH28+hUkI9IbEXOu+vmyvy6ZnssKfUQ8=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=gCtzo1W7Z0BkiMrarJtdcYigDyOF6AL/Q1ED38+a0/m96Yi2qlCTBInxZ0rVYrDYn /TH2qJ9gwgxHrhxU+Fba6Sjk8YcDRFONzpHE9vPeMCWopNKeEqJtiMGuweZpZ3Lshs eXG5gdKEh9fuN0xATex0P8ay3GBogPKmSatKn1/7lzgxFvxR8SqxNUimjFC6Zjl1RD tJkwwtBPNXxLpm/po0XYKBgj1YMMX5o7JywaR3moLwcfar1EGJrOQhRmiQf8IlzmEf I/m3S/pkpMS+nBAUOV3fCm39a+a5zaRMufKbFeMFcLVVd3CVJ5kWSRNB8MdXGeHOSg Ci6BSzKaJeFwg== Message-ID: Date: Fri, 29 Sep 2023 19:13:25 +0200 MIME-Version: 1.0 Content-Language: en-US To: Larry Garfield , php internals References: <48c7bb29-a52c-416e-b855-be2746dc7a84@gmail.com> <5ace1060-dd75-4cdc-b5e2-a2ea617df586@app.fastmail.com> In-Reply-To: <5ace1060-dd75-4cdc-b5e2-a2ea617df586@app.fastmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Re: [RFC] [Discussion] DOM HTML5 parsing and serialization support From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=c3=bcsterhus?=) Hi On 9/29/23 18:58, Larry Garfield wrote: >> \DOMDocument will also use DOM\Document as a base class to make it interchangeable with the new classes. We're only adding XMLDocument for completeness and API parity. It's a drop-in replacement for \DOMDocument, and behaves the exact same. The difference is that the API is on par with HTMLDocument, and the construction is designed to be more misuse-resistant. \DOMDocument will NOT change, and remains for the foreseeable future. > > Would it make sense then for one of \DOMDocument and DOM\XMLDocument to extend the other, then? So that, eg, we can type against DOM\XMLDocument and then support both old and new classes? Or are the construction et al differences enough that is not viable? As one of the persons who convinced Niels of this new API design: \DOM\XMLDocument extends \DOMDocument doesn't work, because it would bring in the crappy non-static load*() methods that the new API wants to avoid, because their behavior is extremely surprising. \DOMDocument extends \DOM\XMLDocument would probably work, but would not provide an improvement in (backwards) compatibility. If you want to support everything, update your type declarations to either \DOM\Document (which is the new abstract base class) or use union types. Please also keep in mind that this is a new API that needs to live for 10+ years. It makes sense to make it as clean as possible and fully opt-in, while not unnecessarily breaking compatibility. Any "extends" hierarchy will likely result in sadness a few years down the road. Better make a clean cut. Best regards Tim Düsterhus