On Tuesday, 3 June 2025 at 02:36, Anton Smirnov <sand...@sandfox.me> 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. 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? Best regards, Gina P. Banyard