Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115876 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 82707 invoked from network); 27 Aug 2021 04:44:31 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Aug 2021 04:44:31 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C44911804D8 for ; Thu, 26 Aug 2021 22:19:07 -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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (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 ; Thu, 26 Aug 2021 22:19:07 -0700 (PDT) Received: by mail-qk1-f179.google.com with SMTP id a66so6086471qkc.1 for ; Thu, 26 Aug 2021 22:19:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=3dOOdbS8jtJ+UnxfhGkwYCZpw5rk6rrLV4FYrzK982c=; b=DKUvD8Hxd1d/hLetlaaEmbGlhSSzmceKPkc0nRpc3bT/ZoJOr1secGGyn7MIcXzPif EbeVRzlGuZhbHr9TTCkpG+q5PhsvuarYyDH5Ir/pZyBWkuK4ni9MScKsxqi0bGCE/3Ug /tMhfD5ST/Ie9/+9Totl8MN4jtbYBzdhNvvj1Z0jF9MDklljRYQptHAKpzn1+dpcFoCt LwX/ZZg4J2jZzeuRPcrZEX6ehkFMLZEKZ7SMKs/CAV//kMg2fIeKv5FkR6nECaQBSxIK CFVGikmnV07owN7KFkurzGuhlKo3nc4fSI3DKSN8w25ABDFpAvdz9tEgxsiFKI9UtdQs vvMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=3dOOdbS8jtJ+UnxfhGkwYCZpw5rk6rrLV4FYrzK982c=; b=lxCZm0nG2gz6Mv5FOWjng24p8AVCQ7OF1nEBAkACdTyM6Lk6DEn8XXBfdC48NZGp7H 7cfRKW46RFeSbBQOItAoN7l0Eu93J5MsNekBsMTwliAslJSLVD6kgd4oNGZV03YWGk0V vY4ZnLJ0Pz9ISb1EMcv+P/c/Eu1fnpTTkNF7BAAtO/oa+Z6Ap70rN/6Vnbu9XSUrHX9y Oo8YgaoAS2+OPMm8x2naf9s5f6tBOnfDHlYd/BCTmbvcS6flF9HdF+iYSJy3Im3mnyxN /BYt0QkrMDzgtpAHTboUpgY36XHlnoN0SLc0/im9WzpRLeRoB4dQSpbo7KYa+Otaso4p TdRA== X-Gm-Message-State: AOAM532ZU5PiBJo+oa/wLtzOYeScAb3TnE49/WJMYnxBElybT3yZh5xM NryDhZpUamHoocPZYsJ+PLyffA== X-Google-Smtp-Source: ABdhPJzsDWCmW3VEhLFnW7UA4waWuIXEZU2s1sk8rmut+cqI48PNKwWmMIEjnEI0RDKVummo94wDsg== X-Received: by 2002:a37:a302:: with SMTP id m2mr7311374qke.155.1630041545786; Thu, 26 Aug 2021 22:19:05 -0700 (PDT) Received: from [192.168.1.10] (c-24-98-254-8.hsd1.ga.comcast.net. [24.98.254.8]) by smtp.gmail.com with ESMTPSA id p1sm4203982qkh.115.2021.08.26.22.19.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Aug 2021 22:19:05 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) In-Reply-To: Date: Fri, 27 Aug 2021 01:19:04 -0400 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <9F149124-AE06-4F25-A410-12C534635A37@newclarity.net> References: To: Pierre Joye X-Mailer: Apple Mail (2.3608.120.23.2.7) Subject: Re: [PHP-DEV] [RFC] Deprecate dynamic properties From: mike@newclarity.net (Mike Schinkel) > On Aug 26, 2021, at 11:02 PM, Pierre Joye = wrote: > I don't know how others feel about it, I think most want to go the > path to (2) and a more strict, if not almost fully strict PHP. Core > devs to simplify the engine, users to allow them easier checks and > safety in their frameworks or libs. End user don't really bother as > far as I can see. We may have to decide once the long term vision for > PHP and then do the changes accordingly, and more importantly, with > consistency. I tend to concur that path (2) would provide the better outcome.=20 However, eliminating dynamic variables would be eliminating the ability = to simulate a(t least one) language feature that some (many?) people = have been using dynamic variables to simulate. Maybe as part of = deprecation of dynamic variables we should also consider adding = this(ese) feature(s) to the PHP language? There are two approaches I can envision, Both would better enable the = S.O.L.I.D. "open-closed" principle in PHP. =20 1.) Allow PHP class declaration across multiple files =E2=80=94 A = use-case for this is what I think is effectively the command dispatcher = pattern where properties contain instances of classes that might be = contributed by 3rd party code to allow those developers to access the = instances by named property: e.g. $cms->map->display() where $map is = added by a 3rd party library to the class for the $cms instance before = $cms is instantiated. See: https://gist.github.com/mikeschinkel/ed4f9594c105dae7371bfce413399948 Some might view this as "monkey patching" but I view it as a more = structured approach, like C# partial classes. 2.) Allow trait usage for a class from another file =E2=80=94 This is = just a slightly different spin on #1. See: https://gist.github.com/mikeschinkel/5b433532dc54adf53f5b239c8086fd63 Each approach has its own pros and cons but it probably depends on which = would be easier and more performant to implement. -Mike