Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110787 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 59196 invoked from network); 29 Jun 2020 19:10:13 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Jun 2020 19:10:13 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B6DE91804F4 for ; Mon, 29 Jun 2020 10:58:56 -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.4 required=5.0 tests=BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, FREEMAIL_REPLY,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS 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-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 ; Mon, 29 Jun 2020 10:58:56 -0700 (PDT) Received: by mail-wr1-f54.google.com with SMTP id z13so17477266wrw.5 for ; Mon, 29 Jun 2020 10:58:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=nSyWmKmrDS3WwY4ZbMwC1z47fUVAw3BG3AG814tovww=; b=XhIPVWhuSN7j7jm4+UVC050qYDYnC/Uwck4uvwu0tnt6e4xnQv9Z9dkF3C4WyirxFJ Y5GxRscuPQgL7ohyM94YRu3R1LmLmnVMsKTzgCnT2TP6POQVnWDY89DjS/l5hwPoNTtl esuA4bLr5ZS48PoxfLnh4z16VedXc/y1FUZjjDw5nkkduHBvPhXd7T9pRVu/1mbtBnc0 BUAPWS1hD6vyulswTe5MmkxXHGYcEFLycHJQqwHy4L763rMd7IXM14UgmAkYiCFWq3HE rv1hn9NYitdz7SPI0tJXQaa4uo/sq5YYDwmpcQrmM88/JMPN44aSVOZBBnS2NySTpNpn SOCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=nSyWmKmrDS3WwY4ZbMwC1z47fUVAw3BG3AG814tovww=; b=kjcQqkXTnElhxG7bkzq5vvheRmLF9KRZSOFvdc2Yeqg+D4xuLwvkMgcEiUfnuoWjpV nPLEGH1e9T9bmLqZOxt8mbitBujy5f1CeNDZ7/PpfLC3xG8V5trwObGvUJ5QYb4BYY2m 9lar9NQfnhzzH7uxh0wi6SKong10a1hrPraFCKGSKsqeuRyzYP/QkuCNhtMeTZLJmedv qJGVIIa60r4D1F7ZDvVpfhFdt7TZkZf+IVemIjF6m2amgrXUUmTIdSvm+P0rx9jcMvMC X00HL0W6iRLhD1/5p0H8Q75nIxJVi3b5Uic/aQ7P6oiO0/aEYbLK5A0BHwChRtFgb5zA 15LA== X-Gm-Message-State: AOAM533dGq4Blc4Xz0S4SRrY8KsZ2CRCkwenjtTvk6JYHLdPBoZSUtJr iNA/F7F1H6COpBZt0Unotqvh19WU X-Google-Smtp-Source: ABdhPJyRiXloeWKMX9RrW3g6LfE9vnMQ694EBoMHkmWmtKnrY5ISDNABG+JzMjiodyttdJ4UZfY79A== X-Received: by 2002:adf:ec90:: with SMTP id z16mr17983262wrn.52.1593453533413; Mon, 29 Jun 2020 10:58:53 -0700 (PDT) Received: from [192.168.0.22] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.googlemail.com with ESMTPSA id f12sm549592wrw.53.2020.06.29.10.58.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Jun 2020 10:58:52 -0700 (PDT) To: PHP Internals List References: Message-ID: <0ac24aaf-39a0-6019-2cba-df3e0a7b7aaa@gmail.com> Date: Mon, 29 Jun 2020 18:58:51 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] [RFC] Property write visibility From: rowan.collins@gmail.com (Rowan Tommins) On 29/06/2020 17:21, Marco Pivetta wrote: > Hey Rowan, > > On Mon, Jun 29, 2020, 18:19 Rowan Tommins > wrote: > > On Mon, 29 Jun 2020 at 16:44, Marco Pivetta > wrote: > > > property accessors seem to perpetuate the bad practice > > of getters and setters > > > > > Outside of access restrictions, a common use case I've seen for > property > accessors is lazy-loading, which I know is something you use in > other forms. > > > I had already tested the write-once properties RFC with lazy-loading: > works just fine ? > I meant that property accessors can be used to implement lazy-loading, removing the need for magic methods and dynamic references to variables, e.g.: class Whatever {     private string $_name;     public string $name {          get {              if( ! isset($_name) ) { $this->loadData(); }              return $this->_name;          }     } } Regards, -- Rowan Tommins (né Collins) [IMSoP]