boot-clj / boot

Build tooling for Clojure.
https://boot-clj.github.io/
Eclipse Public License 1.0
1.75k stars 179 forks source link

New option type `form` #668

Open martinklepsch opened 6 years ago

martinklepsch commented 6 years ago

Some tasks allow you to pass edn forms for evaluation. On the CLI you can pass those as string and we'll read-string them. If you pass a form in a string in Clojure code it will be interpreted as a string essentially resulting in a no-op. See #666 for details.

To prevent users from running into this issue a warning has been added in #666 but this only covers the :eval option of the repl task leaving any other edn options that expect forms as-is.

I think ideally there would be a specific type for options that expect forms (~= function invocations) to distinguish the case of passing data vs. passing a Clojure form.

The Task Options DSL wiki page also mentions a code type but that implies evaluation of the form. As I understand this is most often used to pass symbols?

Preliminary todo list:

Tasks affected

SevereOverfl0w commented 6 years ago

It seems that it would be just as appropriate in cases for a form to be valid as a constant also. For example if I want to use a pre-calculated value from a required namespace. Of course, the workaround is (constantly "foo"), but it seems like a needless restriction.