Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-05 Thread Bob Weinand
On 5.6.2025 02:59:56, Daniel Scherzer wrote: On Wed, Jun 4, 2025 at 4:49 PM Bob Weinand wrote: Hey Daniel, where's the BC break? Nothing which worked today will stop working (except you won't get exceptions in some cases). That's not a BC break. The only thing which stops worki

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Rob Landers
On Mon, Jun 2, 2025, at 18:27, Gina P. Banyard wrote: > Hello internals, > > This is the second RFC out of a set of type system related RFCs I want to > propose for PHP 8.5. > > The objective is to fix a weird quirk of PHP's type system, where void lives > in its own type hierarchy. > This is

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Daniel Scherzer
On Wed, Jun 4, 2025 at 4:49 PM Bob Weinand wrote: > On 4.6.2025 22:39:28, Daniel Scherzer wrote: > > On Wed, Jun 4, 2025 at 1:35 PM Bob Weinand wrote: > >> >> On 4.6.2025 16:54:05, Bob Weinand wrote: >> > On 2.6.2025 18:27:51, Gina P. Banyard wrote: >> >> Hello internals, >> >> >> >> This is the

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Bob Weinand
On 4.6.2025 22:39:28, Daniel Scherzer wrote: On Wed, Jun 4, 2025 at 1:35 PM Bob Weinand wrote: On 4.6.2025 16:54:05, Bob Weinand wrote: > On 2.6.2025 18:27:51, Gina P. Banyard wrote: >> Hello internals, >> >> This is the second RFC out of a set of type system related RFCs I

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Daniel Scherzer
On Wed, Jun 4, 2025 at 1:35 PM Bob Weinand wrote: > > On 4.6.2025 16:54:05, Bob Weinand wrote: > > On 2.6.2025 18:27:51, Gina P. Banyard wrote: > >> Hello internals, > >> > >> This is the second RFC out of a set of type system related RFCs I > >> want to propose for PHP 8.5. > >> > >> The objecti

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Bob Weinand
On 2.6.2025 18:27:51, Gina P. Banyard wrote: Hello internals, This is the second RFC out of a set of type system related RFCs I want to propose for PHP 8.5. The objective is to fix a weird quirk of PHP's type system, where void lives in its own type hierarchy. This is visible mainly in that a

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Bob Weinand
On 4.6.2025 16:54:05, Bob Weinand wrote: On 2.6.2025 18:27:51, Gina P. Banyard wrote: Hello internals, This is the second RFC out of a set of type system related RFCs I want to propose for PHP 8.5. The objective is to fix a weird quirk of PHP's type system, where void lives in its own typ

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Gina P. Banyard
On Wednesday, 4 June 2025 at 09:50, Tim Düsterhus wrote: > Am 2025-06-03 17:42, schrieb Gina P. Banyard: > > > A type system should be logical, and the fact that the top type (mixed) > > is not a super-type of all types doesn't make any sense. > > > I do not consider `void` to be a type per se

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Tim Düsterhus
Hi Am 2025-06-03 17:46, schrieb Gina P. Banyard: > IMO, these checks are useful enough not to be removed. I agree with Ilija (and also Rowan). Well, I'm not sure Ilija and Rowan agree between each other. I believe they agree in that the distinction between `void` and `null` is a useful one

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-04 Thread Tim Düsterhus
Hi Am 2025-06-03 17:42, schrieb Gina P. Banyard: A type system should be logical, and the fact that the top type (mixed) is not a super-type of all types doesn't make any sense. I do not consider `void` to be a type per se, but rather as an indicator for the absence of a value. Basically the

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-03 Thread Larry Garfield
On Tue, Jun 3, 2025, at 4:33 AM, Christoph M. Becker wrote: > On 03.06.2025 at 03:36, Anton Smirnov wrote: > >> On 02/06/2025 20:01, Larry Garfield wrote: >> >>> The result of this RFC is that the following would no longer be an >>> error, yes? >>> >>> function test(): void { >>>    print "test"; >

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-03 Thread 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 c

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-03 Thread Gina P. Banyard
On Tuesday, 3 June 2025 at 16:18, Tim Düsterhus wrote: > Am 2025-06-03 01:46, schrieb Ilija Tovilo: > > > IMO, these checks are useful enough not to be removed. > > I agree with Ilija (and also Rowan). Well, I'm not sure Ilija and Rowan agree between each other. AFAIU Ilija thinks void living o

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-03 Thread Gina P. Banyard
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 r

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-03 Thread Tim Düsterhus
Hi Am 2025-06-03 01:46, schrieb Ilija Tovilo: IMO, these checks are useful enough not to be removed. I agree with Ilija (and also Rowan). To me there is an important semantic difference between “not returning anything” and “always returning null”. I believe that `void` being in a distinct ty

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-03 Thread Gina P. Banyard
On Monday, 2 June 2025 at 21:53, Rowan Tommins [IMSoP] wrote: > On 02/06/2025 17:27, Gina P. Banyard wrote: > >> The objective is to fix a weird quirk of PHP's type system, where void lives >> in its own type hierarchy. >> This is visible mainly in that a lack of return type is not isomorphic t

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-03 Thread Gina P. Banyard
On Monday, 2 June 2025 at 18:08, Kamil Tekiela wrote: > The RFC mentions that this will now become valid: > > function foo(): void { > return null; > } > > But what about the opposite: > > function foo(): null { > return; > } This would also work indeed. > or what Larry was trying to suggest

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-03 Thread Christoph M. Becker
On 03.06.2025 at 03:36, Anton Smirnov wrote: > On 02/06/2025 20:01, Larry Garfield wrote: > >> The result of this RFC is that the following would no longer be an >> error, yes? >> >> function test(): void { >>    print "test"; >> } >> >> // This currently gives an error, but you propose that it >>

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-02 Thread Anton Smirnov
On 02/06/2025 20:01, Larry Garfield wrote: The result of this RFC is that the following would no longer be an error, yes? function test(): void { print "test"; } // This currently gives an error, but you propose that it // would change to set $val to null? $val = test(); There is no error:

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-02 Thread Anton Smirnov
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"

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-02 Thread Ilija Tovilo
Hi Gina On Mon, Jun 2, 2025 at 6:28 PM Gina P. Banyard wrote: > > RFC: https://wiki.php.net/rfc/void-as-null After a read, I think I fundamentally disagree with the proposal. It says (regarding the status-quo): > * void is not a subtype of a function with a mixed return type This is laid out a

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-02 Thread Rowan Tommins [IMSoP]
On 02/06/2025 17:27, Gina P. Banyard wrote: The objective is to fix a weird quirk of PHP's type system, where void lives in its own type hierarchy. This is visible mainly in that a lack of return type is not isomorphic to a function that has a return type of mixed. I think if "void" was adde

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-02 Thread Larry Garfield
On Mon, Jun 2, 2025, at 11:27 AM, Gina P. Banyard wrote: > Hello internals, > > This is the second RFC out of a set of type system related RFCs I want > to propose for PHP 8.5. > > The objective is to fix a weird quirk of PHP's type system, where void > lives in its own type hierarchy. > This is

Re: [PHP-DEV] [RFC] Transform void into an alias for null

2025-06-02 Thread Kamil Tekiela
The RFC mentions that this will now become valid: function foo(): void { return null; } But what about the opposite: function foo(): null { return; } or what Larry was trying to suggest: function foo(): null { print 'test'; } $val = foo();

[PHP-DEV] [RFC] Transform void into an alias for null

2025-06-02 Thread Gina P. Banyard
Hello internals, This is the second RFC out of a set of type system related RFCs I want to propose for PHP 8.5. The objective is to fix a weird quirk of PHP's type system, where void lives in its own type hierarchy. This is visible mainly in that a lack of return type is not isomorphic to a fu