plumatic / schema

Clojure(Script) library for declarative data description and validation
Other
2.4k stars 256 forks source link

Fixing advanced cljs compilation #417 #419

Closed oliyh closed 5 years ago

oliyh commented 5 years ago

Hi,

This fix worked for me in relation to #417

Thanks, Oliy

gfredericks commented 5 years ago

@w01fe this seems fine to me, do you have any objections?

w01fe commented 5 years ago

Yeah, seems fine if a bit unfortunate.

I don't know enough about advanced compilation, is this going to be a problem in other places? Maybe pred if passed a symbol should automatically capture the name or something?

gfredericks commented 5 years ago

I think it would be a problem in user code as well.

Automatically capturing the symbol would require converting pred into a macro, which would be a technically-breaking change, in that any weirdo doing higher-order stuff with it would have to refactor.

We could add a (defmacro pred* [p](pred ~p '~p))`, and then people would have the option of using that. But that's complicated, requires explaining about why it's even necessary, etc..

w01fe commented 5 years ago

Yeah I agree the ship has sailed unfortunately. Thanks again!

Sent with GitHawk

gfredericks commented 5 years ago

Also the macro approach would have edge cases like (let [unhelpful-name integer?] (s/pred unhelpful-name)).

gfredericks commented 5 years ago

Released as 1.1.12.