Thinking about nothing: Solving the weirdness of the `void` type

Paul Backus snarwin at gmail.com
Thu Jul 13 18:57:53 UTC 2023


On Thursday, 13 July 2023 at 17:58:27 UTC, Quirin Schroll wrote:
> **Key idea: Make `void` an alias to `typeof(null)` when used as 
> a return type, with the goal of deprecating `void` return types 
> altogether.**

This proposal seems strictly worse in every respect than 
[Dennis's proposal to make `void` a unit type with a size of 
1.][1] It will break approximately 100% of D projects (even 
"Hello world" uses `void main()`), and in return we get...even 
more special cases than we started with? A type that can be used 
as an array member but not as a return value?

I appreciate the effort you've put into thinking this through, 
but, as the kids say, this ain't it.

[1]: https://github.com/dlang/DIPs/pull/173


More information about the Digitalmars-d mailing list