Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125278 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 BDA291A00BD for ; Mon, 26 Aug 2024 17:35:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724693819; bh=zzgxkcXSUylGM7rv6tWCdwILIISrkucJP8G0VBmxqaU=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=KVt5dkyXsq2zREJd0+old2RY7GkWxQKJTFZU0bs3UvzgGdoxRa2VOoMBQ0jTUYryN LB5WGV5Pg+ZcMyd6w3qZyzT9d4DI2k9A5R0J/Czc6+O+YO+6ZSWf8DBvvp/3/0czP+ 7zDELqXxLOZLghw8LssfX8QF3OD88valwylIy8500gqGeoPnzY7JL8gPLLKZHb5Iik qkURUE+ticOGTvD6K41KWu2kpWUGF+/ULeA0mh1eWonW5SwsfmVd4L4R323E5mBf2v R7+mbhPq0iN4lI/02hNsX7H5wlj3Yc6f9SucZIabtoAFfBl27USoW25CLipDMwNYGb lqFX2vM8zWqyQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3FDCC180042 for ; Mon, 26 Aug 2024 17:36:58 +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=4.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE, RCVD_IN_MSPIKE_H2,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) (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 ; Mon, 26 Aug 2024 17:36:57 +0000 (UTC) Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-690aabe2600so40934307b3.0 for ; Mon, 26 Aug 2024 10:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coggenterprises-com.20230601.gappssmtp.com; s=20230601; t=1724693704; x=1725298504; darn=lists.php.net; h=mime-version:subject:references:in-reply-to:message-id:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=zzgxkcXSUylGM7rv6tWCdwILIISrkucJP8G0VBmxqaU=; b=pLebg80sGI8eGSQ+B43JVXMuePWYYwFAWmfQCQH8OoavhOvrLhCyLIDjj0oIgdXWJU DbpClD7Xr2a8eTa+DA4mOb5TWChqMvM/1WUGmyk4+K552fZCZmXl0qMDP+Pm6L2tFGb9 Rz/nfmm+M4pFxH82kQHek/W9OC+PtL6cE60ZsRJIdusil2R0qp6aiAA3k09FQEAgs99b 7a0tRMfqFDSetoEZ56HsHSiCuOZ1XU/gyf5mNza3XpofH/MoQALcErdMI5iw677dyYzP rn86wr8jPqdtI83EmxXy6fUa23712zFeblSMfa0mabLnqO3VbE+EzqNVGhj4BUPBbIPT UdMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724693704; x=1725298504; h=mime-version:subject:references:in-reply-to:message-id:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zzgxkcXSUylGM7rv6tWCdwILIISrkucJP8G0VBmxqaU=; b=U5LQk8zidZzANcVMSCp36jDnUGjhfZUlhDXkYRV6Npms2n6sJT6Zr2tsY5HNrG6e9p zIXxtgdITiwvpywn69y0xQBs4vH0rehuzvVDw/TpZtrem0ySnNVnZgWt6vc++gBLGQTl QyHXPBdS+8u9pmOh0pPBjh4DSbuIXtfbEpLqK4HJORfmkvjd+FtRYVZyrovY6XPK/9V3 BTX+ApfNjL2UztVt093wf56dxvNBMtICvG8eeN5sD2FsRWBbkLoXnXn560UDv473/HBc +m8RHAVhy6aa9fUp4YveqBdBblE1emQR1iLuc0XJBBwXyOTu0xLORDA4KzyXv5XlcnyG ZBqg== X-Gm-Message-State: AOJu0YxQyL1KgLEH1/TwA6Wkz/YSOMa3laPe11yerNBuQ+Na+i/V/Lqf GIcSlcZj6+1y6TRybRT+5T+MU/3NQOpFlm9trsT+/g96vHxHpBWQNDx3+jwgGic= X-Google-Smtp-Source: AGHT+IHdCSD+kiwcybROStjnbcGwRFrYvlJfT4kn9eVzTF+Ln2sPb3Q72JDq70afkgmv9vmWzyI/EA== X-Received: by 2002:a05:690c:250f:b0:699:7d04:c7b4 with SMTP id 00721157ae682-6c627d0995emr97348977b3.31.1724693704094; Mon, 26 Aug 2024 10:35:04 -0700 (PDT) Received: from Johns-MacBook-Pro-2.local ([207.213.210.67]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6c39b007479sm15806597b3.69.2024.08.26.10.35.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Aug 2024 10:35:03 -0700 (PDT) Date: Mon, 26 Aug 2024 13:35:02 -0400 To: Mike Schinkel Cc: "=?utf-8?Q?internals=40lists.php.net?=" , =?utf-8?Q?Rowan_Tommins_=5BIMSoP=5D?= , Andreas Leathley , Andreas Heigl Message-ID: <172E530A-7D97-4E00-84AB-81057C837461@getmailspring.com> In-Reply-To: <07E4ABD5-B9CE-47FA-BD9E-E42A82CFC737@newclarity.net> References: <07E4ABD5-B9CE-47FA-BD9E-E42A82CFC737@newclarity.net> Subject: Re: [PHP-DEV] [RFC] Default expression X-Mailer: Mailspring Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="66ccbcc6_6b8b4567_12a23" From: john@coggeshall.org (John Coggeshall) --66ccbcc6_6b8b4567_12a23 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline > From the example you gave it appears that we can have a concrete problem when: > 1. There is a parameter with a default value, > 2. That parameter is type-hinted, > 3. The hinted type is declared as a union type, > 4. An earlier version of the library initialized the default with a value having one of the union types, > 5. End-user developers used the library and then use `default` as an expression of that type, and finally > 6. The library developer changed the initialization of the `default` to a different type from the union. > > Did I correctly identify the problematic use-case? Not really. #2 and #3 are irrelevant mixed is actually much more problematic, I wanted to provide an example that was strongly typed intentionally to show the problem even when types were explicit. The relevant portion is #1, #5 and #6. > Ok, so for argument sake, what if they revise the RFC to only allow `default` to be used in an expression when the parameter is not type-hinted with a union? Would that address your concern? Or are there other use-cases that are problematic that do not hinge on the parameter being type-hinted as a union type? It wouldn't be enough, offhand it'd also have to be forbidden for mixed (at which point I think the utility isn't there anymore). --66ccbcc6_6b8b4567_12a23 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
=46rom the example you gave it appears that we = can have a concrete problem when:

1. There is a parameter w= ith a default value,
2. That parameter is type-hinted,
3. The hinted type is declared as a union type,
4. An earlier= version of the library initialized the default with a value having one o= f the union types,
5. End-user developers used the library and = then use =60default=60 as an expression of that type, and finally
6. The library developer changed the initialization of the =60default=60= to a different type from the union.
Did I correctly identi= fy the problematic use-case=3F

Not = really. =232 and =233 are irrelevant mixed  is actually= much more problematic, I wanted to provide an example that was strongly = typed intentionally to show the problem even when types were explicit. Th= e relevant portion is =231,  =235 and =236.

Ok,= so for argument sake, what if they revise the R=46C to only allow =60def= ault=60 to be used in an expression when the parameter is not type-hinted= with a union=3F Would that address your concern=3F Or are there other us= e-cases that are problematic that do not hinge on the parameter being typ= e-hinted as a union type=3F

It wouldn't be enough, o= ffhand it'd also have to be forbidden for mixed  (at wh= ich point I think the utility isn't there anymore).


--66ccbcc6_6b8b4567_12a23--