Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124327 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 94E8C1A00B7 for ; Wed, 10 Jul 2024 00:52:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1720572856; bh=pA9WMi6Ib5yb+jCzl66ytCKdF1M7y7LxrDITBvnxCLw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=SN/Q2pr1esMkaoUbsTLjjGK2+JfZ0KTARxSnEUOlmG6QpthM1LkMZdwqc+JfIFDja OjPk4qDsTuf3gbgXy/EmotuZQmoJqDX4rPbPaI4D++8bBtRhGCec7SsetDqil7BFq9 ZeAjdYOqwDRPWW+vrYcMXgnqTIBcl6F1iqMeIVPt2boxWXkAnoV1m6T/FH+2oOcJpd UiS7UXJ+is7cKsaKO2Z+B4+DCsaDtOXAxyh4i/69O02eFAwO/8boSZwCHi+3JLufd9 z4hOuBodXSK9O4PYKkg+sybmQkTxFBUFhR9dM+49xrGE8PHb70GvIFHYYhbcmqwAgW F2Vai45xrAV7w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 370E2180582 for ; Wed, 10 Jul 2024 00:54:16 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (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 00:54:15 +0000 (UTC) Received: by mail-io1-f46.google.com with SMTP id ca18e2360f4ac-7f38da3800aso241362639f.0 for ; Tue, 09 Jul 2024 17:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; t=1720572769; x=1721177569; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=HTztU/hg+p/uK7aLuz1NJZEhSFD4+oltgqSpJ9HY16M=; b=VGZ71lwEQ3nTAI5xsvQKMj3einx6O3lzapBL6Nz7945cxLA+NuuvkXOwUtg6eOlyJ0 Rn1Kfz44oxnX1hfmQ3usWXDt5tbJo3CCHyU7EHMG03UsSElzcTL9aMbwIg/RuuhD6Qju 5sHJWgv5FLIFMnv+gx7qvGvjU+uZdLizBX/Cc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720572769; x=1721177569; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HTztU/hg+p/uK7aLuz1NJZEhSFD4+oltgqSpJ9HY16M=; b=VAUtzEx1X5KCuNzC4UcPLIFLMvyJgusDCCuY2UElpEDRrnWLbOAsUNurCkmDiTleBA P+UnMqLwymqiV9+4mbL05srCtH7kHe6XoNiINDKMuFtWcMrTsK5+9rrOjOUgtbwQfxAB d2ZF4wcUCYOoy3YPqgsKGNSqez7DDCr9f0CXfbaZ5yONeCjXJcyFc2C70eKowtDLk9Iw HdiH9t3eN3LZWvyoW45l4L/BcyHBZ3dbEIwZjNRpZ6lF2iwU1M+/XEKbz9zxrie5zeA3 7ygflEv8JZeQ6lbSuNoxiopkWpz9o8u2WzUK81uui3P7BEyJmIPJQmf9ICCPUQqPhcB+ UOmQ== X-Gm-Message-State: AOJu0YwTob/eZ+MKt9XQA7+AMI8qaVSiWaIp+h5ZUqmd6LGr3PDcJqGQ YsIsIMdLlRzM5Et7Puwd5iIQlTRw/ls4DmblNeQ0rXLnwux8nFj+SM+A9LEDM1xDIljQJWO2/wV AN40ZPOE3wSoN1hzeROWV1UU5J9peq3bZXmt7RUSus6ddMwce198= X-Google-Smtp-Source: AGHT+IGdMqKHFvM/PbSFzEoJjXstQNgZLg37DutmL3jrQfT/Pqb93BVcAwYFFHboxoN2FYTSXXQEc5RFP+e0w5J03Kk= X-Received: by 2002:a05:6602:8e:b0:7fc:3910:1599 with SMTP id ca18e2360f4ac-8000000c56cmr467633439f.8.1720572769173; Tue, 09 Jul 2024 17:52:49 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 9 Jul 2024 18:52:38 -0600 Message-ID: Subject: Re: [PHP-DEV] [RFC] Improve language coherence for the behaviour of offsets and containers To: "Gina P. Banyard" Cc: PHP internals Content-Type: text/plain; charset="UTF-8" From: levi.morrison@datadoghq.com (Levi Morrison) > 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.