I need to describe a generic type which is "anything but type X, Y, or Z".
So far my feeble attempts to do it with concepts are failing (getting "Hint: Non-matching candidates for not false" all over the place and then "concept predicate failed").
type NonXYZType = concept x
x isnot X
x isnot Y
x isnot Z
As far as I know, it's not possible to have a type class with negative match (this type is anything else but X, Y, Z), only with positive matches (this type is one of X, Y, Z).
Before I rethink my whole problem, is this at all possible?
This works without concepts
type
X = object
Y = object
Z = object
NotXY = not (X | Y)
proc doSomething(_: NotXY) =
discard
let
x = X()
y = Y()
z = Z()
echo compiles(x.doSomething) # false
echo compiles(y.doSomething) # false
echo compiles(z.doSomething) # true
echo compiles(doSomething("some random string")) # true