Bottom Type--Type Theory

Q. Schroll qs.il.paperinik at gmail.com
Fri Jan 18 01:04:58 UTC 2019


On Thursday, 17 January 2019 at 22:13:13 UTC, H. S. Teoh wrote:
> [...]
> This also lets us write sanity-checking expressions such as:
>
> 	float sqrt(float x) {
> 		return (x >= 0.0) ? ... /* implementation here */
> 			: Bottom.init;
> 	}
>
> This is valid since Bottom converts to any type. Then at 
> runtime, if x < 0.0, assert(0) gets triggered.

While unrelated to the DIP discussion, I will insist that x >= 
0.0 and x < 0.0 can both be wrong: x can be NaN.


More information about the Digitalmars-d mailing list