Consider: Transformation is open for extension
ohpauleez opened this issue · 1 comments
ohpauleez commented
Currently, transformation is closed for extension, with all the rules for transformation being captured in a cond
. Consider introducing a protocol with a single protocol-function (-transform [this source-obj args])
which gets called in place of the exception within the else or in a clause before checking for satisfies?
. This would allow users to define new forms of transformation which may be domain specific or are more optimized for their source-obj
.
vvvvalvalval commented
Yeah I've considered it, I'm just not sure it's worthwhile and I'm being conservative in what features I add.
Consider that:
- when you reach this point, maybe it's time you reach out for a more expressive transformation lib like Specter;
- any 1-argument function is a valid transformation, and transformations can be combined, so you always have that escape hatch.
- opening for extension also means more cases to consider when programmatically manipulating transforms.
I might reconsider at some point, so feel free to post examples of use cases justifying the suggested approach.