Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127571 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 lists.php.net (Postfix) with ESMTPS id F2CAA1A00BC for ; Tue, 3 Jun 2025 19:01:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1748977164; bh=z7/pcFBRf4Scsjg5TO4kZHisdd/y7HquRVBbbPQedO0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=cOCYYDlPDlRbNql0Gtk7h2zJ5yxwEuHnKv4f4UDX83jdui5JpBFWcScGQDi1jwrBf M6esR5vkjFdhnuIbGaxlna7C38hvcv1kXflB8TbAzN73VcO662Lb1EPqHYGTUy10IW wYGQSLPVSrKvEoiUtUfSE1YUBuCco2qZJal/5z2fR0IHl56Q0K6f4mzMp78eVwBjEe edriub3k4srcPrep3FRbNK8101VayRme4C6VvtGU5tqjXyvy4qfJWIP2GKrS7r6zRb yQ8BBpZ+9OWCTyvoxIBx+nEMFoISMLSEvLDU6hUQTnUJQSbwv+0DS7+QiXxCb46H1O Z8gijv4TiU7oQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EDF4C180053 for ; Tue, 3 Jun 2025 18:59:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-108-mta127.mxroute.com (mail-108-mta127.mxroute.com [136.175.108.127]) (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 ; Tue, 3 Jun 2025 18:59:23 +0000 (UTC) Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta127.mxroute.com (ZoneMTA) with ESMTPSA id 197372b7cd80008631.002 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Tue, 03 Jun 2025 19:01:26 +0000 X-Zone-Loop: 36ffae5c2cb0852302a8b9607b49a9d13f73c6e43bfc X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sandfox.me; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References:Cc: To:Subject:MIME-Version:Date:Sender:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=XpRwohTELcj27W5BzhW4xsJjMmoDdCMPO0JcgJjDCAQ=; b=SYUqdVOJRSPR vFzV2vHrnetnawa6EbwiMnfANmPScIIwBYdSzpWSBtiy+NAF3wjAA4kPPzTqwYQTLSl57LDc3f2Of dEbalCYYVpa9gfUpiKQTdEDT/ijxlll5SiiEZHMALy/KIqWxbBxAFjK7OgdC6Qy3p3O5sOcZLr/dO hufUCchhyyKXq9vzYYgLwx2Ngwo2++HBD1rHQl7fFyuTowNK1cOb7dPtPZyXVhFWg7P1/p3AksiX4 Lo7Ub53VdHA1UbxFZbR9zkBbp1A1dRSvVC/uGt9rQjZ3e/C5iAtQWY+Dm6h4OICe0RyQU42jyr+u2 r41Sru4mqTMPmt0iq1JzlQ==; Message-ID: Date: Tue, 3 Jun 2025 22:01:22 +0300 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] Transform void into an alias for null To: "Gina P. Banyard" Cc: internals@lists.php.net References: <6Z2Ysh6MjYp1nyzuB0bTPJc5srObIcMRqt731JaQeXUJk1f_V_Yo2nRn8WvjI7er7pp7pIUE6WYl5pRwvYrtcrd07nCutyAqKPSsZHmrS-Y=@gpb.moe> <7f7dc3dc-bb9a-4f6e-9b77-055c4a8801d1@rwec.co.uk> <0ac00d42-7584-4de2-bca4-9099f3d4cbb5@sandfox.me> <9CMD5Mjh0unmR6G9NjfMonV9S7q8KQ9F29o8OdcndyaZ4_sOMOGuQU8chWKRdz6LYwslYWnuWM069sWhWt8ZTFRiQluEWqjZOXME0UZ2Zrc=@gpb.moe> Content-Language: en-US In-Reply-To: <9CMD5Mjh0unmR6G9NjfMonV9S7q8KQ9F29o8OdcndyaZ4_sOMOGuQU8chWKRdz6LYwslYWnuWM069sWhWt8ZTFRiQluEWqjZOXME0UZ2Zrc=@gpb.moe> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated-Id: sandfox@sandfox.me From: sandfox@sandfox.me (Anton Smirnov) On 03/06/2025 18:20, Gina P. Banyard wrote: > On Tuesday, 3 June 2025 at 02:36, Anton Smirnov wrote: > >> On 02/06/2025 23:50, Rowan Tommins [IMSoP] wrote: >> >>> I agree the type hierarchy you describe is weird, but rather than >>> throwing away the functionality completely, I wonder if we can make it >>> more consistent: >>> >>> - Make "no return type declared" and "mixed" equivalent >>> - Make "void" a sub-type of "null", and therefore a sub-type of "mixed" >> >> >> I think that null and void are semantically very different so I'd like >> to suggest just making void subtype of mixed. This will both keep the >> semantic meaning of void and make mixed and undeclared mean the same thing. > > You are going to need to expand on why you think those two are semantically very different. > PHP does not have the concept of "execution control is returned to the calling scope, but no concrete value is returned". > And this is a good thing IMHO, as it means you can always take the result of a function. Basically I agree with Ilija and Tim that functions that "return null" and functions that "return nothing but it's shown as null for historical and compatibility reasons" are different, but I see some value in aligning mixed and undeclared return type behavior. > Moreover, "just making void subtype of mixed" can mean everything and nothing. > Do you mean for void to live on its own island like the int or string types? > Make it a subtype of null like Roman suggested? > Have void be a super type of some weird union of types representing scalars int|string|float|bool? > Something else altogether? this: > Do you mean for void to live on its own island like the int or string types? never <- void <- mixed -- Anton