-
-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Is your feature request related to a problem? Please describe.
It is possible to have a list, set or non-typed thing with a restriction. There is however, no way to see or get the restriction except for just trying to add something. In case of a list of set we could find the restriction by looking at the parent and check the type definition. This is not easy.
Describe the solution you'd like
Add a restriction() function which return value is nil when the list, set or thing is not value restricted, or a string with the restriction.
Describe alternatives you've considered
Instead of a function on the types, we could introduce a root function which accepts a value. As this function is only valid for a limited set of types, this solution seems not the best.
Another name is also an option. For example get_restriction(). Another option is to re-use the restrict function but this is not a good idea as the restrict function can only set the restriction on a thing, and, restrict will always generate a change.