> I'm guessing {.raises.} only cares about exceptions that are always present
> regardless of -d:danger.
Correct defects are not tracked by the effects system(and defects generally are
oddly used).
> Here's another few head-scratchers:
Nim presently does not have any mechanism to set a default value for a type, so
presently everything is defaulted to 0. As to `Natural + Natural` it's a
subrange type, it's not a distinct range type. It uses the integers addition as
such it does not return a ranged value. Consider `range[2..4](2) +
range[2..4](3)` it's unsafe to just use the integer mechanisms to do this then
assume it's in the range. It's of course not ideal but one can again resolve
this themselves with the following:
import std/[typetraits, macros]
type Range = concept r
r is range
macro getBaseType*(r: Range): untyped = r.getTypeImpl[^1][1].getType
proc `+`*[T: Range](a, b: T): T =
T(getBaseType(a)(a) + getBaseType(a)(b))
proc `-`*[T: Range](a, b: T): T =
T(getBaseType(a)(a) - getBaseType(a)(b))
proc `*`*[T: Range](a, b: T): T =
T(getBaseType(a)(a) * getBaseType(a)(b))
proc `div`*[T: Range](a, b: T): T =
T(getBaseType(a)(a) div getBaseType(a)(b))
echo typeof(Positive(10) + Positive(1000))
Run