Unexpectedly nice case of auto return type

Meta jared771 at gmail.com
Tue Dec 3 22:15:27 UTC 2019


On Tuesday, 3 December 2019 at 22:11:39 UTC, Meta wrote:
> On Tuesday, 3 December 2019 at 17:45:27 UTC, H. S. Teoh wrote:
>> The thing is, `void` means "no return type" (or "no type" in 
>> some contexts), i.e., void == TBottom in that case.
>
> Not *quite* correct. void is not a bottom type; it's a unit 
> type, meaning that it's a type with only 1 value (as is null, 
> interestingly). void does not mean "no return type"; it means 
> "there's only 1 possible value that can be returned". A 
> function returning TBottom means that the function will never 
> return, e.g., it loops forever, or throws an exception, etc.

Whoops, skimmed over the post already mentioning this.


More information about the Digitalmars-d-learn mailing list