LightTable / Clojure

Light Table Clojure language plugin
MIT License
99 stars 51 forks source link

lighttable.nrepl.handler Does not conform to spec #91

Open ghost opened 7 years ago

ghost commented 7 years ago

clojure 1.9.0-alpha12 has broken a lot of old code that relied on "features" that didn't really exist, but worked anyway. Moving forward, it seems like spec is allowing clojure.core to become better at "seeing" when you use it in a non-conformant way, and will be vocal about it.

Right now if you try to make a blank lein project, import into lighttable and depend on [org.clojure/clojure "1.9.0-alpha12"] and (ns whatever.core (:require [clojure.spec :as something])) you will receive an error: lighttable.nrepl.handler does not conform to spec ... Reason: additional argument

I'm uncertain, but I think this is referring to line 12. I'm fairly sure that "hanging" requires like this isn't specifically allowed by ns, even though it appears to work fine. I could be mistaken though. One of the big motivators for introducing spec is to try to clean up code that is relying on incidental rather than documented behavior of core functions.

sbauer322 commented 7 years ago

This is a good catch, but even with the fix to line 12 (see PR #92) I still get an error regarding spec. We have been keeping track of the trouble with using 1.9 in Light Table and believe the problem to be stemming from the low Clojurescript version used internally. We are in the process of updating it but it is a nasty task - see https://github.com/LightTable/LightTable/issues/1973.

Sorry I don't have better news for the time being.

BorisVSchmid commented 7 years ago

A [edited - less horrible now] functioning workaround is as follows:

Download https://github.com/clojure/clojurescript/releases/tag/r3308, change the file src/main/clojure/cljs/source_map/base64_vlq.clj by adding a ":" before the "require" on the second line, and then install this fixed version of clojurescript in your local repository ("lein install" - make sure there isn't such a version in the repository already - it is located in your ".m2/repository/org/clojure/clojurescript" directory)

Then you can use your regular LightTable (no need for the development version), and it will work with the new 1.9 alpha's.

[the above works if it is just you that need clojure.spec to work - not if you expect others to be able to work with lighttable and your code, unless they apply the same workaround]

sbauer322 commented 7 years ago

Thank you @BorisVSchmid - this is quite helpful in confirming the problem.

Though the workaround is not ideal, it is still something. It is appreciated!

BorisVSchmid commented 7 years ago

Happy to help. Still like lighttable best as a clojure IDE, but was running into the spec limitation.

I guess one could deploy a fixed version of clojurescript 0.0-3308 to clojars (name it 0.0-3308B), and use that as a project dependency in the project.clj of lein-light-nrepl. Would that bring the clojure 1.9-alpha12+ to current lighttable users?

sbauer322 commented 7 years ago

It may, but I suspect we will still encounter problems in other parts of Light Table until those parts run on a higher version of ClojureScript as well. Not positive, however.