dlang-community / SDLang-D

An SDLang (Simple Declarative Language) library for D
http://sdlang.org
Other
121 stars 21 forks source link

Change Value's type to prevent assigning infinity/NaN #42

Open Abscissa opened 8 years ago

Abscissa commented 8 years ago

While #27 is technically fixed, it would be better to prevent infinity/NaN from even being placed into a Value in the first place. This would make it much easier to track down occurrances of infinity/NaN in user code (ie, fail as early as possible).

Instead of being a straight algebraic type, Value should become a thin wrapper over an algebraic type that throws when the value is set to infinity or NaN.

Might want to do this together with #43.