What is the best way to express that, say, an Int field or parameter should never be negative?
The first thing that comes to mind is the annotation for the type, for example case class Foo(x: Int @NotNegative) . But I would have to come up with my own annotation, and there would be no compilation time check or anything else.
Is there a better way?
source share