Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125261 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 9168E1A00BD for ; Mon, 26 Aug 2024 10:23:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724667898; bh=ua+GxKVklij1ncbGmtXYcx1pB+r+Q9DB8eTmtLoic0I=; h=Date:Subject:To:References:From:In-Reply-To:From; b=jYe75T3APM1CVzbztLK0/yuCpTLMlfuzIH0MpcDwaamxyAuqehJquwEDKB7ptfhCh wEQg16IT7oaREr6SeN2LttWP6kSCVECgZSBWDZrd1ZF/hcoEQLDLlQN0PV8joG76Ye Kk8AR4a6N2ma613UmpJAoIsd17uCMoTwqpEO5yuLpF0LiqnA9gGQYKnklubeonU7PU 6Yb30rOu7OUTRBQVK6JfQWZVp6Icxi8nuL60UXUa/DQOxkxdM4ZeKmtMY6UL0HlHhI D2iLNiAF1NHAM+NlNZvr3yAvS5gdz70H0oI5ITfnoon2AXXGI83UVWYcx23rWkdAiy 9aOiQ9DOiGIww== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 18510180052 for ; Mon, 26 Aug 2024 10:24: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=0.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,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-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 10:24:57 +0000 (UTC) Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4281c164408so35547495e9.1 for ; Mon, 26 Aug 2024 03:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scriptfusion-com.20230601.gappssmtp.com; s=20230601; t=1724667784; x=1725272584; darn=lists.php.net; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=JJao+ukLr4myUUTJWiF2kkUUjRiWiDfJOFDjqAmF7X8=; b=xo254qbDKyNQzuS0yIIQkADe94nBTbnPpCyemA7QLmVLqnYUoqIM0LJiHdnpjdcklc qkEXZ1loCh3a/7R6YoqPSK6s8lTKjI10rH5G08IcsfaMtnQuR9JqvtKgPwCupluJhBET 4fKkQ6MGZ1KY71GFjAaw8zrqjdrLEvQ+7i8A4R2FMt0yGQ6FvMptjSp12TqyhyyiEWvA 5LcQOZyeX2D+T6tL9U2EsCcDYI15WS77VOKLyVUQqtgNeEMEMbX3Ume9ISxxQwbAON77 1dNYrQ+hL1YOLGYwoUOnBwE7B70lKJLZ/cwKZhXmCR1iyy6iFWmxXLV9XTMDscp3YfUw CJiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724667784; x=1725272584; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=JJao+ukLr4myUUTJWiF2kkUUjRiWiDfJOFDjqAmF7X8=; b=snAQbBH12rDYjc7bTZtIpxfz64z8PvFQZQu4QJWUEIxdOyNd0J076X9ga9oHFvr8jC vencWcj/s6a39jhh+IF4PB4kJ4cnesqk+bey8oe8sTs5ynyewvhhMhhvjlOGdH9Yl+4H gsxeO9s6NLUuuDX8kSWVSyjMYFPu9hzv4TObzFnEGlzhX9vBQTT9LHp+NwOe/UzpDiP7 i8Y9rDlszuypSMB/Z4WCYyk0ADJPYvGoQ4Z/yVF0IbX5z8P4xWnM+bI4PbHHoADBgo0t yEoveKyc3NnTIbAWQbG5D3FQM47BOYipwPr74WVAIo6l1ywy/8gazF/4vS/eAFrcM4q1 QA0w== X-Gm-Message-State: AOJu0Yw8GO6nCzc5w9mSE0Fi2kksXZE1rbh/0foQR2iQ7FpI8QZqNJGI N8IgCG/rnYb1YrfZ+B2OmIqvV/E1q20AdA6YonL1JbyRz/GRgYf4YJgID+UfvS1XHgUcNn3JS0+ x X-Google-Smtp-Source: AGHT+IGmxH62OPdXh97kjq6d86V9rw9I+DFI4nysUPSWIwF02jn7clgBw7mRdUw+6ZBd7UjjA81+IA== X-Received: by 2002:a5d:48cc:0:b0:367:8ff5:5858 with SMTP id ffacd0b85a97d-373118fb985mr5244139f8f.56.1724667783528; Mon, 26 Aug 2024 03:23:03 -0700 (PDT) Received: from ?IPV6:2a01:4b00:bf09:5101:24c4:e0bf:99bf:8460? ([2a01:4b00:bf09:5101:24c4:e0bf:99bf:8460]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-3730813c465sm10414249f8f.32.2024.08.26.03.23.02 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Aug 2024 03:23:03 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------trVLvrVhX0wWgZ3lDAeHdKk5" Message-ID: <3d34e7e8-c0ee-436c-a7bf-3773a19635f2@scriptfusion.com> Date: Mon, 26 Aug 2024 11:23:02 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] Default expression To: internals@lists.php.net References: <0c8ed5d6-5507-4c41-8d7f-05d14ba8aa4c@scriptfusion.com> <15301ee5-7964-4f0b-8804-a19f95f43152@gmx.net> Content-Language: en-GB In-Reply-To: From: bilge@scriptfusion.com (Bilge) This is a multi-part message in MIME format. --------------trVLvrVhX0wWgZ3lDAeHdKk5 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 26/08/2024 11:11, Andreas Leathley wrote: > On 26.08.24 11:26, Bilge wrote: >> >> I would like to fix this if possible, because I think this should be >> valid, with emphasis on /if possible/, because it may be >> prohibitively complex. Will update later. >> > That would be a way to fix it, to basically make isset(default) a > possible check if there is no default, similar to an undefined > variable check. It would also recognize a default value of null as not > set in the same way, so one could not differentiate between null and > not defined, but that is in line with the language in general. It would not be possible to write `isset(default)` because `isset()` does not operate on expressions. Similarly, it would not be possible to write `default === null ? ... : ...` because you would receive the same error as above. If we special-case null coalesce then it will literally only be possible to check with null coalesce. As for feasibility, I definitely believe it is feasible. Though some may argue whether it's worth the trouble for this edge case, I would still like to implement it. Cheers, Bilge --------------trVLvrVhX0wWgZ3lDAeHdKk5 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
On 26/08/2024 11:11, Andreas Leathley wrote:
On 26.08.24 11:26, Bilge wrote:

I would like to fix this if possible, because I think this should be valid, with emphasis on if possible, because it may be prohibitively complex. Will update later.

That would be a way to fix it, to basically make isset(default) a possible check if there is no default, similar to an undefined variable check. It would also recognize a default value of null as not set in the same way, so one could not differentiate between null and not defined, but that is in line with the language in general.

It would not be possible to write `isset(default)` because `isset()` does not operate on expressions. Similarly, it would not be possible to write `default === null ? ... : ...` because you would receive the same error as above. If we special-case null coalesce then it will literally only be possible to check with null coalesce.

As for feasibility, I definitely believe it is feasible. Though some may argue whether it's worth the trouble for this edge case, I would still like to implement it.

Cheers,
Bilge

--------------trVLvrVhX0wWgZ3lDAeHdKk5--