zlacker

[return to "Nimony (Nim 3.0) Design Principles"]
1. esafak+uTb[view] [source] 2025-12-05 14:08:33
>>andsoi+(OP)
> "Modern" languages try to avoid exceptions by using sum types and pattern matching plus lots of sugar to make this bearable. I personally dislike both exceptions and its emulation via sum types. ... I personally prefer to make the error state part of the objects: Streams can be in an error state, floats can be NaN and integers should be low(int) if they are invalid.

Special values like NaN are half-assed sum types. The latter give you compiler guarantees.

◧◩
2. saghm+pWc[view] [source] 2025-12-05 18:48:38
>>esafak+uTb
Yeah, I'm not sure I've ever seen NaN called or as an example to be emulated before, rather than something people complain about.
◧◩◪
3. echelo+OZc[view] [source] 2025-12-05 19:01:09
>>saghm+pWc
Holy shit, I'd love to see NaN as a proper sum type. That's the way to do it. That would fix everything.
[go to top]