Closed gsnewmark closed 4 years ago
Fixes issue #5.
There are two obvious issues with new StructDispatchMap implementation and I'm not sure this simplification is actually worth it :disappointed: :
StructDispatchMap
1) we can't obtain dispatch value to show in error in case no dispatch branches matched the value https://github.com/KitApps/schema-refined/compare/feature-cleanup-struct-impl?expand=1#diff-599ae3465d726ee432cd5735a58c70a9R1245 I believe this can really harm readability.
2) dispatch value for input would be extracted for each dispatch branch separately until one of them matches https://github.com/KitApps/schema-refined/compare/feature-cleanup-struct-impl?expand=1#diff-599ae3465d726ee432cd5735a58c70a9R1240 This one probably harms performance a bit, especially if dispatch-fn is complex (but why would one make it complex?), but in my opinion is not as bad as the first issue I mentioned.
Given the issues I've described initially, I don't think it makes sense to switch implementation, especially taking into account Schema didn't have any breaking internal changes during the last year.
Fixes issue #5.
There are two obvious issues with new
StructDispatchMap
implementation and I'm not sure this simplification is actually worth it :disappointed: :1) we can't obtain dispatch value to show in error in case no dispatch branches matched the value https://github.com/KitApps/schema-refined/compare/feature-cleanup-struct-impl?expand=1#diff-599ae3465d726ee432cd5735a58c70a9R1245 I believe this can really harm readability.
2) dispatch value for input would be extracted for each dispatch branch separately until one of them matches https://github.com/KitApps/schema-refined/compare/feature-cleanup-struct-impl?expand=1#diff-599ae3465d726ee432cd5735a58c70a9R1240 This one probably harms performance a bit, especially if dispatch-fn is complex (but why would one make it complex?), but in my opinion is not as bad as the first issue I mentioned.