Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124342 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 3F2381A00B7 for ; Wed, 10 Jul 2024 12:10:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1720613542; bh=FH34RHaRogc5lIKaQQFvG/v0bkusD/W04DQly/O501o=; h=In-Reply-To:References:Date:From:To:Subject:From; b=E274rEt+xswzORDGvNUkR0loh0iM+nahgtGZBmGeoCrJLoESyis0CmI7qtJ1/CSAj Xu4l0cBoCbfv0TXY98jjjdLANXx5RO6RJmcM664IGMXw0vF2XTlvHBXV4tQHQjeHy7 rEtMvcKld6qsBRZY50q6IowTKwBofeg+EcNDRpEObaGr3qscfjwDSlq1QzDCKXfncO ooOkZJMj7Pwxnn7fMQ6MhfaYWkKXeTOS0wL1nOqz5qy7LsP5bS8c+vqC/6N/lhCzGl n8D1591+SODSQKwyXfx1hbdK7fzn3YNfajV6qEQkDeEYuG0FBSNPafifhhyd3a3IMT fjLGpAMeTyLBQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D386C18005B for ; Wed, 10 Jul 2024 12:12:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fout6-smtp.messagingengine.com (fout6-smtp.messagingengine.com [103.168.172.149]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 10 Jul 2024 12:12:21 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfout.nyi.internal (Postfix) with ESMTP id 0D25C138601F for ; Wed, 10 Jul 2024 08:10:55 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Wed, 10 Jul 2024 08:10:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-type:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1720613455; x= 1720699855; bh=pErrQf8WQgAk/eovQL8PtspnxgYW7rmilV8Gf0+SJUM=; b=V JnKhg9AvIcxvqYz97quRN9W64oC3G/b8dWHjVUCtYxvE4aVVOhHOiu2GJQpbeuhM 1TaJ0DFL1abgGhDXVFVMykXPrT9p0ezTQ+NNssqk90igpI4C3S0PpWjQYnVCRq6E x49pZl6MBnmIDxM3BCN6seEazLav3OOwqz1cn6RxodAmv7uvqNGmhXJvb+YCVcLN skCqenKQbGMYTuOQ/9BeiyaFU8vbPpILex9QX7cUlhPY6F4Ufd99zk56Q3xkpFa6 5tMLmSjUWAGd1bUxmBPv39DrNwQ4y29RLwFu9Fi2HdmX/NOH4sFRIirid+5tJnzb dOr/LI2PFHR2Svc9PSbGw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1720613455; x=1720699855; bh=pErrQf8WQgAk/eovQL8PtspnxgYW 7rmilV8Gf0+SJUM=; b=X4IF2Zclw4rLcMGZDJJWSUZoTjFHTo0M/149wJayt9mo CPVOFM0+cCjkL/CIBePnsgFukQDBux/2jgC1h9WyODAfuNdm5k4xA9p/j9ANVMFB p+0NaXiRyQMVwLfTxOqWNy2uAz/EfW7A0tzTrQhymAJhRC0szK5Cyzz5GUjzEY1/ Rl/VO9H/Y/R5AOOdNXraUu5cbdEUOx6IrN/i+LRReeyJ3EiyFKBw45C2GjZMoj1w dmAPRMkJe0XZHN3+tz/YOHqofVJwOBonmIhpAqNWEG/FfzNASgrAVlqUPbCtkIFa iyI8GDBieintg01Y/t43bFsRrgNUvCntb/Fty7Xv1A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrfedugdeglecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgrrhhr hicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh eqnecuggftrfgrthhtvghrnhepkeetleehffegfedvudefueejkefhvddtueeuvdevteei veehledugeejudfhhfetnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghr fhhivghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id C018E1700093; Wed, 10 Jul 2024 08:10:53 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-568-g843fbadbe-fm-20240701.003-g843fbadb Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: In-Reply-To: References: Date: Wed, 10 Jul 2024 07:10:33 -0500 To: "php internals" Subject: Re: [PHP-DEV] [RFC] Improve language coherence for the behaviour of offsets and containers Content-Type: text/plain From: larry@garfieldtech.com ("Larry Garfield") On Tue, Jul 9, 2024, at 7:52 PM, Levi Morrison wrote: >> Moreover, I know the traffic on the list has been pretty high, but I do intend to have this RFC up for voting for inclusion in PHP 8.4, and I'm not exactly sure how I am meant to interpret the lack of responses. > > I am personally strongly in favor of the direction. As mentioned in > the PR, my main concern is honestly quite a small one: I think > `Appendable::append` ought to be renamed. Maybe `Appendable` and > `FetchAppendable` too. > > The reason is that `append` is a common operation on a container type, > which is likely to want to implement these interfaces. I easily > identified a few such things with a quick GitHub search: > 1. > https://github.com/pmjones/php-styler/blob/5c7603f420e3a75a5750b3e54cc95dfdbef7d6e2/src/Line.php#L166 > 2. > https://github.com/ParvulaCMS/parvula/blob/dcb1876bef70caa14d09e212838a35cb29e23411/core/Models/Config.php#L46 > > Given that I anticipate these methods to largely be called by > handlers, and not by names, I think an easy solution is to just name > this `offsetAppend` to match the other offset operations. For example, > I don't anticipate code doing: > > $container->append($item); > > I expect largely they will do: > > $container[] = $item; > > So it doesn't really matter if the name is `append` or `offsetAppend` > for the main use-case, and thereby we avoid some road bumps on > adoption. Any SPL containers with `append`, such as ArrayObject, can > make it an alias of `offsetAppend`, I think? > > Anyway, this is a minor thing, and I will vote yes regardless of > whether it (and maybe the *Appendable interface names) are changed. > But I do think it would be prudent to change it. It would also match > the `offset*` convention of the other interfaces. Based on my research into collections with Derick, I agree that "append" is not a good name to claim for this interface; it would make it incompatible with standard collection method naming. offsetAppend() would neatly side-step that issue. +1 to what Levi said. As to my limited response so far, it's mostly because I read through the proposal in detail a few months ago when it was first informally put forward and liked it then, and it seems there haven't been any serious changes since for me to comment on. I am very much in favor, though. --Larry Garfield