Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119159 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 12400 invoked from network); 15 Dec 2022 19:53:29 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Dec 2022 19:53:29 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 55FEA18058F for ; Thu, 15 Dec 2022 11:53:28 -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=-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 ; Thu, 15 Dec 2022 11:53:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1671134006; bh=OlYRYuLGNBZ7YPqJbnFUTrbq1ijCp9vwYk0//ze3gkU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=RkIOjc1KAi40DfoyHzSDZD29jhlaiv+lD+05D0tUbvWRjXmHZmnTnG7bPCodCEAk1 TugNB8WSIpswuojhl/OHSooXeJA3a+7m75VAI14kcDll5QOHJtyQYp16tcnDqD+T4Q 4bSVG0x4Kwj71TOdN44N1USJCh+skxv5OdkvSq9VIGhGnpJsaNlK7wh8l41Z1m9Z0e /0w9ZN2tkIYWlr03AjNg2ZEMDw97tShXiDDVIUjg7pVPG3tXmhWtpRtAbcgy3ZsRMY AIb3xkYS9rW0fzv2QtOYxLqXHO5BathXS+lwUgvqZTObTriqb0Y5/GFR1w90GgNjoD VPLCTqYJ5OPug== Message-ID: <145c02eb-44f3-e28f-d66b-7e6334539342@bastelstu.be> Date: Thu, 15 Dec 2022 20:53:25 +0100 MIME-Version: 1.0 Content-Language: en-US To: Deleu Cc: Andreas Heigl , PHP internals References: <09aa499b-f5ec-5e80-63d8-6271fa87c390@heigl.org> <60ba972f-5b7c-f9ea-fb07-7b565bd108cd@bastelstu.be> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Unicode Text Processing From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=c3=bcsterhus?=) Hi On 12/15/22 19:51, Deleu wrote: >> [1] The 'Text' class should likely be made final, because folks might >> otherwise rely on a specific userland extension, preventing actual >> interoperability. >> > > I'm fond of final classes but in here I think it *adds* burden to core > developers. As you said it yourself having a Type within PHP will help > interoperability. Having this type be final will hurt interoperability > because everyone's wrapper will be different. This may lead to the > community requesting more changes to core. The wrappers may be different, but they would all be expected to provide a method to retrieve the underlying 'Text' object that every wrapper would know how to use, without the need to actually *convert* between different representations. Furthermore if the class is not final, then every future (method) addition to the class API would be a possible breaking change, if the method is already in use in a userland subclass. For the kind of methods you would add to the 'Text' class there usually is only one reasonable name (there's only so many possible names for "replace", "pad", "split" or similar). Thus any future additions would result in headaches, because (1) either userland breaks, because (2) some less-than-great method name needs to be used or because (3) the addition is not going to happen at all, because (1) or (2) are both unacceptable. Then there's also the point about subclasses not necessarily be a drop-in replacement (either because methods are overriden if not final, or because the immutability is violated). We already had a similar discussion recently with regard to readonly classes, but I'm not sure a gentleman's agreement to not create "incompatible" subclasses is strong enough of a guarantee for something that is a similarly basic build block as the 'string' type itself [1]. Best regards Tim Düsterhus [1] Java's 'String' class is final, I would assume for the same reasons, see also: https://softwareengineering.stackexchange.com/q/97437.