Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120220 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 49977 invoked from network); 9 May 2023 12:39:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 May 2023 12:39:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E6C4F1804D7 for ; Tue, 9 May 2023 05:39:54 -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=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 9 May 2023 05:39:54 -0700 (PDT) Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-4f24cfb8539so2951310e87.3 for ; Tue, 09 May 2023 05:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683635993; x=1686227993; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Q0IAmyC/YOybDnWeqyDPu33g98p1dgdrvzlO/3KFwd4=; b=dnVVl01L0ABZau2DRZMxKN1aZR+QK9ZkfvmlmmHJRd73HSXRT2QlMEaYogh+fG+/Ij kg05qDB1+H0d71gyq02wDiglzXgLSmlXeYfn/gH4n0AJ5OiLL2geaQGP9GunFqvdFKtM LVdqEPJ7GSE8oPEL4tpgQT9zma3ksX2EsFfkgyIdqouG1hFTPOsgZe8eS4fUSTRBe1FH Pl9FpWBkoEiHG49g7DrEVPJzLLoMbXa3osgJsNZjXm6d1RcFoV8T1D7wyD5S/Xh3mAIF WTzw5vCjVlMH6flSsYjAA8RerTR2w7iGq0I5Uy+MYukkH+/wqMNB8A+K2YzTcNurBGT/ Nnpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683635993; x=1686227993; 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=Q0IAmyC/YOybDnWeqyDPu33g98p1dgdrvzlO/3KFwd4=; b=kPvxf7riM/ldOoqFaks1OnE5tzKM8+wVi0KqR5wbOQ3kpSYCmo6DpEsFffwjbuxU14 FJTBzpiFE8uapdBBS+OSY7K9c7JEfbHTUAsaCMl+/o1DZg3stJogYH6sGjjxt3V5p2Ih 1C4ibm+ReUUO1eBiSTX6kwwuay7mr/vExCVCM2xsLuUkl4ODM7RldJzt+kcRTbWiICoX kSImAEzml5OJrlZR3oXQnU/M/e/U5B6XJJ1w2stDrlT0ycChYeZbKNL58mc+V/nG0sEL 9VU/rm7sOT5c/0oxE9lyH3eERiWFSXNIPbmft5nTAtSAklT+/rmvKbphOLaHuqO58i/W namQ== X-Gm-Message-State: AC+VfDz4uLFPqvgjD+V8Uaoejk2jwMeHLY0WTph5wHiGRrfTedx6S6oS 9dTj/wSajv8dl8+pRM1kOkhyH3cG+QwZIEDpbBM= X-Google-Smtp-Source: ACHHUZ5xLRRHjszM/dlXkRiBjGUH05sH94tzzMBWYo3EujOZEvoy5ksdltOx6dJX5IHGudhXrxGSz9el+AEEuundgeg= X-Received: by 2002:ac2:5d2c:0:b0:4f1:46ba:b089 with SMTP id i12-20020ac25d2c000000b004f146bab089mr597916lfb.27.1683635992384; Tue, 09 May 2023 05:39:52 -0700 (PDT) MIME-Version: 1.0 References: <641b1ca0-d33f-4f38-ae64-81b4abce24da@app.fastmail.com> <40e1f208-4bda-bd8e-da28-2341948b343d@gmail.com> In-Reply-To: <40e1f208-4bda-bd8e-da28-2341948b343d@gmail.com> Date: Tue, 9 May 2023 09:39:15 -0300 Message-ID: To: Dik Takken Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="00000000000041d8a105fb420d18" Subject: Re: [PHP-DEV] [RFC] Property hooks, nee accessors From: ericklima.comp@gmail.com (Erick de Azevedo Lima) --00000000000041d8a105fb420d18 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable It looks great! Thank you so, so much. I've been wanting this for a long time. I have used properties in C# and it's very useful. I'm reading this RFC since it was in draft. =3D) One thing that I did not understand was this piece of code: class C { public array $_names; public string $names { set { $this->*_prop* =3D explode(',', $value); // *<---- Where this "_prop" is coming from?* } } } $c =3D new C(); var_dump($c->names =3D 'Ilija,Larry'); // 'Ilija,Larry' var_dump($c->_names); // ['Ilija', 'Larry'] Does "_prop" have any special meaning or is it just a typo? Thanks one more time for this! Regards, Erick Em ter., 9 de mai. de 2023 =C3=A0s 08:52, Dik Takken escreveu: > > > On 08-05-2023 23:38, Larry Garfield wrote: > > Ilija Tovilo and I would like to offer another RFC for your > consideration. It's been a while in coming, and we've evolved the design > quite a bit just in the last week so if you saw an earlier draft of it in > the past few months, I would encourage you to read it over again to make > sure we're all on the same page. I'm actually pretty happy with where it > ended up, even if it's not the original design. This approach eliminates > several hard-to-implement edge cases while still providing a lot of > functionality in one package. > > > > https://wiki.php.net/rfc/property-hooks > > > > Thanks for all the work that has gone into this. It looks great. The > ability to add properties to interfaces is also really nice. > > One thing that concerns me is the following: "the use of [] on any > property (with or without a key) will result in a runtime error being > thrown". While the intent of the RFC is to allow adding hooks without > causing BC breaks, this detail does introduce a BC break. And the break > may get introduced without realizing it. > > I'm not sure which solution would be best here: Just accept the > limitations for arrays (same as for list properties in Python) or forbid > the use of hooks for array properties? I'm leaning towards accepting the > limitations, like Python does. Then it is up to the API designer to > decide if a property hook is the right tool for the job or not. > > Regards, > Dik > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --00000000000041d8a105fb420d18--