Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114275 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 4147 invoked from network); 4 May 2021 17:57:10 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 May 2021 17:57:10 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5C88B180211 for ; Tue, 4 May 2021 11:03:13 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from cache4.mydevil.net (cache4.mydevil.net [213.189.55.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 4 May 2021 11:03:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=korulczyk.pl; s=devil; h=Content-Transfer-Encoding:Content-Type:In-Reply-To :MIME-Version:Date:Message-ID:From:References:To:Subject:Sender:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=nqm1vfy+12fiJdiOUZ4YCkiulnIYff/3I5egEd13guw=; b=AejvH3mZLhnafmNKqVVfjwsLC8 3TiQATdK15qJ56BPikaul+EaKuV8jDnl5zEneiCF+neNv9j22fkGZdcqgakghR4tixmMsscVMz/Ym 8T0fN8PDT0tHH3q+ch9Zjv4tQYc0ENRkRG7THoaI9eoYDmqvBUZkYvj0hvmo7ZQNrb/c=; To: internals@lists.php.net References: Message-ID: <1f89692a-ee16-270c-0a13-8bbe75ef373c@korulczyk.pl> Date: Tue, 4 May 2021 20:03:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-System-Sender: robert@korulczyk.pl X-System-UID: 1534 Subject: Re: [PHP-DEV] [RFC] Property accessors From: robert@korulczyk.pl (Robert Korulczyk) W dniu 04.05.2021 o 18:32, Marco Pivetta pisze: > I'd strongly advise killing by-ref array push there: it's an acceptable > limitation, for the amount of benefit we get :P > In fact, people doing `__get` now are already familiar with "Indirect > modification of overloaded property" (https://3v4l.org/6dTXK) They are familiar, but this is not a reason to cripple property accessors concept with the same limitation as `__get()`. "Indirect modification" is really annoying, and using reference to bypass it looks more like a dirty hack than real solution. If we can avoid "Indirect modification" for implicit accessors without involving references, then it is definitely worth it. And this is important for explicit accessors too - in my case like 90% virtual properties are some kind of conversion between string and array, where getter returns array generated from string. It would be great to handle this too, even if it will be only syntactic sugar, where `$object->property['key'] = 'value';` will be equivalent of this dance: $temp = $object->property; $temp['key'] = 'value'; $object->property = $temp; Regards, Robert Korulczyk