structural-typing
structural-typing copied to clipboard
Polymorphic types?
I have a vector with items of several related types (form field data like RadioField, Input, Label) and I'd like to validate that each item conforms to the appropriate type structure. (Types may be identified by the :type keyword the item map. nil value for :type is an error.). Does the structured typing library have a way to support this sort of polymorphism?
I'm thinking if the type supplied to built-like
could be a function, I could supply a multimethod that returns the type keyword structured-typing expects, but I'm not sure if that's just a solution to my narrow problem, or whether it's broad enough to incorporate into the library.