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. lairv+7id[view] [source] 2025-12-05 20:31:44
>>esafak+uTb
That's why I always disliked calling null the "billion dollar mistake", null and Options<T> are basically the same, the mistake is not checking it at compile time
◧◩◪
3. the_gi+hTd[view] [source] 2025-12-06 00:16:57
>>lairv+7id
...and if everything was wrapped in Option<>.

If my grandmother had wheels, she'd be a bike.

[go to top]