Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121701 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 72264 invoked from network); 16 Nov 2023 21:39:02 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Nov 2023 21:39:02 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 88367180031 for ; Thu, 16 Nov 2023 13:39:02 -0800 (PST) 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.9 required=5.0 tests=BAYES_00,DMARC_MISSING, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (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, 16 Nov 2023 13:39:02 -0800 (PST) Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-53f9af41444so1911479a12.1 for ; Thu, 16 Nov 2023 13:39:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700170740; x=1700775540; h=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=W+yOXhpHYD8zmn8LV4oR/RhmirZw3aojBmoRyCWdZ9E=; b=gSN+hq6aJ4FLAwET/SLEoldX72FNiIyloD50mxhCbYKuw5ieshIVXAOUqG0puWo/bP mBUdpskiZTR8THWw++REgZIuTgyETEftgeqa9lSxuuumLy7VUxVhA4Zlws1wx5tz27Mp /UkXtDYdTldg6PT50D5H2PBHukLRgzr7Q7WilItoqTideNDbVHAR5Tpt+fx4dmTdDbaa cQKjImjqYeYlMFtADbU/Q+U7DpR1s111htbtXV3foatzVOl9HglWaRa4/WpxStsPnfbh Ao2v8NUB8VsQ9uJpLEtpP2WVamS2dT6pQhSZJa0/9BhBAqECTqSZsN2DW9b7sjifzeRZ 9uew== X-Gm-Message-State: AOJu0YzOlg93f9iXM4hX1XaND5hxQ3xvfEiIrTn+6XJ4tm0MJY0b2WKU TIjpupcf9/11sD52W2xFstJ4vBfeL+7YbncfHUjTIrY1 X-Google-Smtp-Source: AGHT+IEWy4zaOuJmXVOrbo3BdsyXA5NkQEDPYRGUp7srobKwWvz6mhLZ842HdMH1nyawDPs4hIOmEbcHxLKSZvcJSE8= X-Received: by 2002:aa7:d699:0:b0:53e:21f6:d784 with SMTP id d25-20020aa7d699000000b0053e21f6d784mr14229416edr.8.1700170739766; Thu, 16 Nov 2023 13:38:59 -0800 (PST) MIME-Version: 1.0 References: <2b4591c1-f999-49b5-8061-67db816aa0da@gmail.com> In-Reply-To: <2b4591c1-f999-49b5-8061-67db816aa0da@gmail.com> Date: Thu, 16 Nov 2023 21:38:48 +0000 Message-ID: To: Rowan Tommins Cc: PHP Internals Content-Type: multipart/alternative; boundary="000000000000005854060a4bd9ff" Subject: Re: [PHP-DEV] [RFC][Discussion] Harmonise "untyped" and "typed" properties From: bukka@php.net (Jakub Zelenka) --000000000000005854060a4bd9ff Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Thu, Nov 16, 2023 at 8:41=E2=80=AFPM Rowan Tommins wrote: > Hi all, > > I have finally written up an RFC I have been considering for some time: > Harmonise "untyped" and "typed" properties > > RFC URL: https://wiki.php.net/rfc/mixed_vs_untyped_properties > > > Currently, changing a property declaration from "private $foo" to > "private mixed $foo" changes its behaviour in significant ways, even > though no actual type checks are added. This RFC seeks to remove those > differences, by extending the "uninitialized" state currently reserved > for typed properties to cover all declared properties: > > * Properties without an initial value will be "uninitialized", not "null" > * Calling "unset" on a declared property will make it "uninitialized", > rather than the current complex behaviour > > > There are a handful of open questions still in the RFC, but I wanted to > present an initial draft to start the discussion, because the current > behaviour is quite hard to explain in a short e-mail. > > Please let me know your thoughts. > > This sounds like a huge BC break. Probably bigger and a bit harder to fix than disallowing dynamic props. I have seen is_null and similar checks done on uninitialized props many times and this will certainly break such cases. You can say that it just requires adding default null value but that might not be that simple if you depend on some library or code base is big. Maybe it would be better to do this as some sort of opt in behaviour using class attributes which could even disallow untyped props completely as it would be opt in... Cheers Jakub --000000000000005854060a4bd9ff--