|
|
|
|
|
by escherize
3904 days ago
|
|
It would be interesting to see a "When structural-typing is better than prismatic/schema" section in the readme. I read the readme, and I don't see why you can't use something like s/validate instead of built-like. So instead of: (type! :Point (requires :x :y))
(some->> points
(all-built-like :Point)
(map color)
(map embellish))
To keep it simple, as in the first example of the whirlwind tour, we could use: (def Point {:x s/Any :y s/Any})
(some->> points
(s/validate [Point])
(map color)
(map embellish))
It's good that structural-typing does not use macros, instead building ontop of specter which is pretty cool. So is there a performance enhancement?It's clear that one should use structural-typing where an expertise with specter has been attained, Not sure when else it's the best choice. |
|