Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123939 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 11BFC1AD8EA for ; Thu, 27 Jun 2024 14:32:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719498842; bh=7X24LsSCz/+0WzB5CZGOPYjnAABauAy9NzPJ4Q+n+Lc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=adLK/ngISth0YtGtPhio0cqULFpuUGtVlaXtOiurr8rcU/uQp+u149ana7HFDTMeO Elqi2cPUHCqSs0m4ga4jMvUov6x+U7V3WV6RpALKbg9fHB61zaCk0JB1gptG4Ehg88 vKxoXRUS3fCqvTnssIDYlLjkfltzv7qP6UjF5l/5NSv1p2KWnZ6Yceq0VaMBGH61fE 9Qby+kNjXHAVFwYb83QNfII7yPkX84aLz45Oz3mSicOTKIBBg5pRAj2s1LsAyUMhHV 0FJ+r94H39dXJA/FaJgo3tbkL9sDdTYxGYZJs+B4BQsWFJKK26WZvuLNv0becxwNax ZWFsEafLovdrg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C0F6018007B for ; Thu, 27 Jun 2024 14:34:00 +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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, 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: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (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 ; Thu, 27 Jun 2024 14:33:53 +0000 (UTC) Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-57d203d4682so2089652a12.0 for ; Thu, 27 Jun 2024 07:32:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719498754; x=1720103554; 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=fvQYGVUt2u72tn8U8bRTvG2rfluLcze2kNS2sNscrOU=; b=PgU5KhIn0ur4fFs0AUCgPxZHOgw5ocIuow0Z0q79IOaiZkyl+0uaj6+JNN8RELmqJT Ww2zRFGbrqtrV1r+26cqqVtKXE/D4rKTIuX3nZ8KAVfHZc70jIdIViu+PUjmhUTc6ZBq T26G4Bv/fGH9aQVLMNajs6y1KJzXkqZeIAFIcZgMq9YYxlfdfDMCDLfc5p5jELRlP4Z5 Rj+xdvvjiUiDAFU9DqvHcQ+12XpoGG+zcLBt91gjVvm20mYK8DhlMXygNb19oD/83HMD MBnhZaHevSej0vFAxZFRjKzglTVnQyuuqfGds3Or+HZIgvBqSyhgibkww0/sdpebRW+M iASQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719498754; x=1720103554; 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=fvQYGVUt2u72tn8U8bRTvG2rfluLcze2kNS2sNscrOU=; b=R4MyBw4+aDRlet0kJz+iM9uPch+1zGMZ9J2BQGnOCADveA+m5LfqtnK1k3Ck23PQW1 45ZwfrC8lS3CnGoM1Hc42vi2yQhMGu0oARFdGHwGKJqUI++joI1TGzRsaQvGEAPp9VjQ MRzuqiw8cO4LtZRhoPxopFpRWxfyT12vuEzKxsXXHbFsxp1gu/klAAe6lZItJe6qG8I/ qUpB/vJAAsytGOJeVcZEH1Qc5Wi6bYEYhvGtjbz4zHbq3Xp8m2ENVFCAmGjodIjgZozL 7iZvZ/AOti/M2enikqKW2sPTgtG+/8hXL7307W6KHlm2euZNNVxb6yByUt+nNKhCOoei pK9g== X-Forwarded-Encrypted: i=1; AJvYcCXaERGDWqWLUl2QAvqk9MVsBWI1hRGCH839iNtCU1r0d6R8buN5YxY8kyutvn/YO7kaI894lwZqpe1k4o4Sy3EiyZZSx92v0g== X-Gm-Message-State: AOJu0YwdUlrmZ0hNZpx15BuTCekthQ1dpBDr1Sb2GS6KXnhrQmGB7gQN 3DIeLY7+J0+7JOM6PksR25Ywr4orBSsMZfbnRdP/+eDqXbbcaRyJE5DKHMkPFeobkEbJnvBBaog RdVnhKQlm4KGvWo0gSd2zxZXlIQBnozyR X-Google-Smtp-Source: AGHT+IGnS373OfFDIWG1ow9PAcfhK1vU7FhMrfMbD5Ass4jCoH5C2m9fZUa59YMwSoO5bNLr6vyiRG6HCYpmcsmNnws= X-Received: by 2002:a17:907:c206:b0:a72:81f5:85d5 with SMTP id a640c23a62f3a-a7281f58b9dmr446354566b.23.1719498753766; Thu, 27 Jun 2024 07:32:33 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <28781fd3-82ac-4c69-88a1-3ead4f0081b9@app.fastmail.com> In-Reply-To: <28781fd3-82ac-4c69-88a1-3ead4f0081b9@app.fastmail.com> Date: Thu, 27 Jun 2024 16:32:22 +0200 Message-ID: Subject: Re: [PHP-DEV] [RFC] Lazy Objects To: Rob Landers Cc: Nicolas Grekas , PHP Internals List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: arnaud.lb@gmail.com (Arnaud Le Blanc) Hi Rob, On Wed, Jun 26, 2024 at 11:09=E2=80=AFPM Rob Landers wr= ote: > Can you add to the RFC how to proxy final classes as well? This is mentio= ned (unless I misunderstood) but in the proxy example it shows the proxy cl= ass extending the proxied class (which I think is an error if the base clas= s is final). How would this work? Or would it need to implement a shared in= terface (this is totally fine IMHO)? The example you are referring to in the "About Proxies" section is a digression about how the lazy-loading inheritance-proxy pattern could be achieved on top of the lazy-loading state-proxy pattern implemented by this RFC, but it doesn't represent the main use-case. To proxy a final class with this RFC, you can simply call the newLazyProxy method: final class MyClass { public $a; } $reflector =3D new ReflectionClass(MyClass::class); $obj =3D $reflector->newLazyProxy(function () { return new MyClass(); }); Best Regards, Arnaud