Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123062 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 332701A009C for ; Tue, 9 Apr 2024 16:07:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1712678899; bh=OUdWpDQu0iktzIHrSQkBDez8LU+WL4amV0/DoQTw/hM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=hh6dt/E71H3fhOvhK8Xk2O2crOrZxRnuLYlqwH7K9T3U0EcDNKpd2kIH/qkP2l3DO TCztuy85HNklgp6dGyfUI2Itr3PCSWvjewICm6co+J0R9W/TON8zhSp2H6wgJiyULz qoUW6KsbtGBE6uLgSJH9utCFjOeI11UkBvqudaEnf3L04D/hskx7J68RNAPB/dQCeZ a9eJYegwnvL5T2Bdz8iUtIj6w/mQgdl1k8K21DgMwkYiJ0XArbDyfKVzE+lAnyr+rd a/Jvx8Z2YDqnDlB9HDG5Otg4FS/rxYDUMyn48aKcaZFHyMR1mGHeQ0n6NNwQlFYskk HB6aaT2khujsQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 51B3F180582 for ; Tue, 9 Apr 2024 16:08:19 +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=-2.1 required=5.0 tests=BAYES_00,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,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) (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 ; Tue, 9 Apr 2024 16:08:18 +0000 (UTC) Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-7d5f0a155e3so72049839f.0 for ; Tue, 09 Apr 2024 09:07:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; t=1712678866; x=1713283666; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=OUdWpDQu0iktzIHrSQkBDez8LU+WL4amV0/DoQTw/hM=; b=CMSNMGNRtlSDx7lf/oNeLBo3eUbpEBv2biATwuVHnlurgPU4dZijPkb9DzBMuFvyte VrWgV271YTn/5cxosUfpfbNxgSS9hxIfjtSmtHqC4S1F5vLX3Qu9sSQgoqJEl5y38N9c 4m+mbd87dnsoPYFrJX69sA8ClWG1N9obE4ut8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712678866; x=1713283666; h=content-transfer-encoding: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=OUdWpDQu0iktzIHrSQkBDez8LU+WL4amV0/DoQTw/hM=; b=t/2IgIgzKePw+xD6wba/5sDev1XqOC2K8ag4WYsUEf+oSQlfeB5eMTKjhw0BKQwgTc gJJt92LvU0u3z+Bd3wBnxWt6gGsXymlb45nguatFB8SAG+YWGDJ/PBYh12gf+FCV0AVh BlhBu9cl3i36oVA6/GbqFEbNgMI/jbPOBVjJE8IZJV1s/GsHT1dIGp6REqOueti5ssHh yt026k8vBX5A5XeO2jeROjgwdHrklIXJNme4ikMobzvbHsh+vhsAqbJW87kqvRnz74Vf e+kMiNw+SOtDnDdGAwMl8fYA3IpGeo4mv+VG5Hs8LEoWU9Uw8UVu0XG+m2AiCEmcraA3 y7VA== X-Gm-Message-State: AOJu0YwgWCqgEiqq7P7y4qRMnypNjcNIeKtKW/SPpB7D79jldZabRONy jnJ6WdNuwk0WYENP4Trhuo/pJscLa+XU5e/Lq5UMEydA+j/5+TKgR4dWXWxKht3thbihHIBlsu/ au2CZVMitkwT8wZSDBSVFzhEFkL3YQbmOPlrjAg== X-Google-Smtp-Source: AGHT+IG9w8UVNATBJ+Re9hmybImGFbHc6SHND3PW3jY1cgsQBdDncF92N2M1XhXGVb9JAKOZWrw1MR6IopH+1jTLlRY= X-Received: by 2002:a05:6602:488d:b0:7d6:36cc:bf36 with SMTP id ee13-20020a056602488d00b007d636ccbf36mr380002iob.5.1712678865787; Tue, 09 Apr 2024 09:07:45 -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 Apr 2024 10:07:34 -0600 Message-ID: Subject: Re: [PHP-DEV] [RFC][Vote announcement] Property hooks To: Ilija Tovilo Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: levi.morrison@datadoghq.com (Levi Morrison) On Mon, Apr 8, 2024 at 3:42=E2=80=AFPM Ilija Tovilo wrote: > > Hi everyone > > Heads-up: Larry and I would like to start the vote of the property > hooks RFC tomorrow: > https://wiki.php.net/rfc/property-hooks > > We have worked long and hard on this RFC, and hope that we have found > some middle-ground that works for the majority. One last concern we > have not officially clarified on the list: > > https://externals.io/message/122445#122667 > > >> I personally do not feel strongly about whether asymmetric types make = it into the initial implementation. Larry does, however, and I think it is = not fair to exclude them without providing any concrete reasons not to. [sn= ip] > > > > My concern is more about the external impact of what is effectively a c= hange to the type system of the language: [snip] will tools like PhpStan an= d Psalm require complex changes to analyse code using such properties? > > In particular, this paragraph is referencing the ability to widen the > accepted $value parameter type of the set hook, described at the > bottom of https://wiki.php.net/rfc/property-hooks#set. I have talked > to Ond=C5=99ej Mirtes, the maintainer of PHPStan, and he confirmed that > this should not be complex to implement in PHPStan. In fact, PHPStan > already offers the @property-read and @property-write class > annotations, which can be used to describe "virtual" properties > handled within __get/__set, already providing asymmetric types of > sorts. Hence, this concern should be a non-issue. > > Thank you to everybody who has contributed to the discussion! > > Ilija I was playing around with 3v4l.org. Is the implementation up-to-date there? I don't have any hard objections at the moment, but after playing with it for a while, I do kind of wonder if it's a lot of complexity for what is effectively a niche feature because: 1. It does not support asymmetric visibility for get/set. Having a public getter and private setter seems really natural. 2. You can't access accessors for "siblings". 3. You can't do by-reference set (important for arrays). 4. You can't satisfy a parent's readonly property with a getter in a child= . Now, points 2 through 4 are fairly minor and niche by themselves, but if we take all these restrictions as a whole... I'm a bit worried. I also don't like the syntax. I can ignore this for the vote and still vote yes because I don't like the syntax, but with these other things... I'm worried.