bottom type as parameter or local variable, does that make sense?

Timon Gehr timon.gehr at gmx.ch
Mon Jan 17 23:51:37 UTC 2022


On 17.01.22 20:39, H. S. Teoh wrote:
> What kind of special cases, specifically?  Making variables of type
> noreturn illegal does not preclude taking parameters of type noreturn.
> Most current generic code does tests of the form:
> 
> 	template someTpl(T)
> 	if (is(typeof((T t) {
> 			... // tests on t here
> 		})))
> 	{ ... }
> 
> This wouldn't be affected by the fact that T may be noreturn. If the
> generic function actually needs to instantiate a variable of type T,
> then it*should*  be a compile error when T is noreturn anyway (because
> it can't possibly do anything meaningful with such a variable, and the
> fact that instantiation wasn't prevented means there's a logic error
> somewhere).

+1. Exactly what I was wondering about too.


More information about the Digitalmars-d mailing list