Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108688 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 42826 invoked from network); 19 Feb 2020 21:20:34 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Feb 2020 21:20:34 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AAFE6180531 for ; Wed, 19 Feb 2020 11:36:33 -0800 (PST) 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,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,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-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) (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 ; Wed, 19 Feb 2020 11:36:33 -0800 (PST) Received: by mail-io1-f45.google.com with SMTP id z8so1917299ioh.0 for ; Wed, 19 Feb 2020 11:36:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GiQi2z4qxEBSSq6t44YujrK3YqypyjzqFDr/J89ZFT0=; b=KnVUocsiUyRIMKJWDSjNdRfj7Kc/HtliaAeY8xupN4xs3kIxjsGZ41yVXnQZhwy/Np a+N5G5yuSz6rXehkg5O8ey8oXNeYGqwBhOhoY5FyG4thnf7LMnjdMD6uVMDbIQnqgUcs ZTw0wI8NzWU2S3IKQ+XI0PJhRXvy9PJXhvOUyR1VmTah2i3c4s3InNQzrYGOvG3KQULL UunBdXMA4c9ISPpGVPk+gPjhQ7Ht6oviO99YVSgRGUTeu9YR08pTce2PICPmkKW0a0KG gW3Q6r4IAqorM28nCg1UvTyPQUQYO+z5jPdUqwkcWnxxBJNWk94cLyOnAoPesrx0Dhse LVIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GiQi2z4qxEBSSq6t44YujrK3YqypyjzqFDr/J89ZFT0=; b=t9BP4DDB8fYD7ScZqj31k5JzmsPA7J/A3llXW1UUB93gV2+U/3HJwKAxi/vHG9dSgh oNksYyxbENCVi8/mYQatyN98EVz08y3bMEPLLZ4lxn9RHjuE3IIBwfUQnNzWxrV9tKM1 22yWMDHX+LdK4UM9yc5Q8lk8enMc30Y7RUGDriTTbhnMsv86TLLOog3zmaSrURy/LFK0 OnmoUGCZ1hfsWgekrYLSVEQYd6D/y2uQ26jGp4GI/MTQdf1hu1eIOWCAwDQJ2l8arV6p 22Nb266ZEKJazcWBsg1IbGVjp/TTj+2KWWlVqVPJX8xt8iEaPvM+8hARmmMF7SyNu98c mODg== X-Gm-Message-State: APjAAAXSnOjb5+XmHbp5I4r88zNsL0HMhiw1cK6Tpc/1E8bstuPM38Bt RQX4CPG+pEv8JTldZAvwILtKiWQV6V/L/esr2e9Th+v7 X-Google-Smtp-Source: APXvYqz26s87J5YDdFfB7t3zwZF2Yswf1+6jeNq3oy3dBbPqQemqf2ujvx1gL7ynW64B0JaAAmU5tKP73a4xb9qBzKM= X-Received: by 2002:a6b:1781:: with SMTP id 123mr20057371iox.282.1582140989447; Wed, 19 Feb 2020 11:36:29 -0800 (PST) MIME-Version: 1.0 References: <65c78b5a-55a6-4f1f-b881-f1401aa7dbb1@www.fastmail.com> In-Reply-To: <65c78b5a-55a6-4f1f-b881-f1401aa7dbb1@www.fastmail.com> Date: Wed, 19 Feb 2020 20:36:17 +0100 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="000000000000a92305059ef2e77a" Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Immutable/final/readonly properties From: ocramius@gmail.com (Marco Pivetta) --000000000000a92305059ef2e77a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 19, 2020, 19:51 Larry Garfield wrote: > On Wed, Feb 19, 2020, at 11:05 AM, M=C3=A1t=C3=A9 Kocsis wrote: > > Hi Internals, > > > > I'd like to move my RFC forward to the discussion phase: > > https://wiki.php.net/rfc/write_once_properties > > > > In short, I propose to add support for a new property modifier that wou= ld > > allow properties to be initialized, but not modified afterwards. > > > > Cheers, > > M=C3=A1t=C3=A9 Kocsis > > As envisoned, does this allow for a property to be set to a dynamic > value? My concern is that while a public locked/writeonce property is > great for access, it doesn't do anything to enable lazy setting on first > access. In fact the only way to do that would be to make it private and > wrap access in a method, which would look exactly like that does now but > with an extra keyword that doesn't actually offer much. > > You could set the value in advance in the constructor, but then it's not > lazy, just locked. > > Is there a way it could support lazy-on-first-use then locked? M=C3=A1t=C3=A9 did run a few teats: operating on a lazy value (before initi= alisation) seems to work as expected =F0=9F=91=8D --000000000000a92305059ef2e77a--