Skip to content

Add a restriction() function on list, thing and set type. #240

@joente

Description

@joente

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions