Re: [heycam/webidl] add a type to represent the undefined value (#60)

There are theoretical points for `void` and practical points for `undefined`, also seen in TypeScript (makes a strong point for `void`, but relaxes it in practive - we should not follow that if not needed).

However, a good explainer is due (a digest of this issue discussion might serve as one).

I would aesthetically prefer to say `void` for functions that actually _don't_ return anything, in order to state there is _no_ return value. A function that does not return a value is analogous to a property not being present, rather than one being present but having the `undefined` value.

Between returning `(undefined or TYPE)` and `(void or TYPE)` I strongly prefer the former.

Applying Occam's tool indeed suggests getting rid of `void`, but I just can't get over the new signatures like
`Promise<undefined>` instead of `Promise<void>` 
and 
`undefined foo()` instead of `void foo()`:
it does not seem to be an exact formulation.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/60#issuecomment-676032795

Received on Wednesday, 19 August 2020 09:33:56 UTC