structural-typing icon indicating copy to clipboard operation
structural-typing copied to clipboard

Polymorphic types?

Open spiffytech opened this issue 8 years ago • 3 comments

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.

spiffytech avatar Oct 18 '15 17:10 spiffytech