zlacker

[return to "Nimony (Nim 3.0) Design Principles"]
1. mwkauf+M2[view] [source] 2025-12-02 01:00:22
>>andsoi+(OP)
Big "college freshman" energy in this take:

  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 (low(int) is a pointless value anyway as it has no positive equivalent).
It's fine to pick sentinel values for errors in context, but describing 0x80000000 as "pointless" in general with such a weak justification doesn't inspire confidence.
◧◩
2. ratmic+sIb[view] [source] 2025-12-05 13:10:09
>>mwkauf+M2
Without the low int the even/odd theorem falls apart for wrap around I've definitely seen algorithms that rely upon that.

I would agree, whether error values are in or out of band is pretty context dependent such as whether you answered a homework question wrong, or your dog ate it. One is not a condition that can be graded.

◧◩◪
3. Mond_+Ghd[view] [source] 2025-12-05 20:29:11
>>ratmic+sIb
Meh, you also see algorithms that have subtle bugs because the author assumed that for every integer x, -x has the same absolute value and opposite sign.

I view both of these as not great. If you strictly want to rely on wraparound behavior, ideally you specify exactly how you're planning to wrap around in the code.

[go to top]