The case for NaN

H. S. Teoh hsteoh at qfbox.info
Thu Jul 30 15:58:04 UTC 2026


On Thu, Jul 30, 2026 at 03:20:48PM +0000, monkyyy via Digitalmars-d wrote:
> On Thursday, 30 July 2026 at 07:30:54 UTC, Araq wrote:
> > On Sunday, 5 July 2026 at 19:08:44 UTC, Walter Bright wrote:
> > > On 7/5/2026 1:37 AM, Richard (Rikki) Andrew Cattermole wrote:
> > > > What we are able to do here though is throw static analysis at
> > > > the problem: https://github.com/dlang/dmd/blob/master/changelog/dmd.fastdfa.uninitialized.dd
> > > 
> > > 
> > > Static analysis cannot solve the problem 100%. It's the ole' halting
> > > problem.
> > 
> > No, it's just you not understanding the halting problem. In reality Java
> > solved this problem since its inception. Many other languages followed
> > since then.
> 
> Walters correct here, you either ban things or have holes.
> 
> Java doesnt have void*, so they havnt solved the problem for the types of
> things youd use a void* for in c.
> 
> Suppose I have a ubyte and a void* and a list of types for a tagged
> reference, I use 0 to mean void itself, 1 for int etc. then N+1 I use to
> mean slices of my sumtype and there will be an int that the length of the
> slice at index 0. Then N+M is a slice of slice of... of my sumtype, till you
> fill up the ubyte.
> 
> Its valid, good luck convincing an opinionated static checker to allow it.

That's called a tagged union.  An old, well-known idiom.  Pretty sure
static checkers can be taught to recognize it.


T

-- 
Eat more doughnuts.  It's the original hole food.


More information about the Digitalmars-d mailing list