On Tuesday, 18 July 2017 at 20:49:56 UTC, Timon Gehr wrote:
On 18.07.2017 20:46, Yuxuan Shui wrote:
On Tuesday, 18 July 2017 at 15:26:59 UTC, Timon Gehr wrote:
On 18.07.2017 14:19, Stefan Koch wrote:
[...]
D has a C-inspired first-order type system, so it is not
necessarily crucial to have it in D. (The reason I got
involved in this thread is that it was proposed to add Bottom
as a type that is not really a type; 'void' is annoying
enough as the 'null' of types. We don't really need another
one of those.)
[...]
What about void?
You can't have a value of type void, but it is not empty either.
For example, this means that the following transformation is
not always valid:
return foo();
Could you explain why `return foo();` is even legal for a `void
foo() {}`? I wasn't aware of it before and the fact that you can
(syntactically) return the non-existent return value of `foo`
raises cognitive dissonance flags for me. I imagine there's a
type system reason?