Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Determine root cause of data readers not working outside of a project #13

Closed
avescodes opened this issue Aug 20, 2013 · 6 comments
Closed
Labels

Comments

@avescodes
Copy link
Owner

Currently, the following shell and REPL commands work inside of a project, but not out.

$ lein try method-fn "0.1.0"
> (require '[method.fn])
> ( (map #mf/i toUpperCase ["foo" "bar"])

Inside of a project, the result will be ("FOO" "BAR"). Outside of a project, you will see this error:

RuntimeException No reader function for tag mf/i  clojure.lang.LispReader$CtorReader.readTagged (LispReader.java:1190)
RuntimeException Unmatched delimiter: )  clojure.lang.Util.runtimeException (Util.java:219)

Determine the root cause of this error, whether it is a fault of Leiningen and if we can correct for the problem

@xsc
Copy link
Collaborator

xsc commented Oct 27, 2013

I just made another observation: data readers seem to only work correctly inside of projects with :eval-in set to :subprocess, i.e. the above example will also fail in Leiningen plugin projects (:eval-in-leiningen true). Not sure what to make of it, though.

@avescodes
Copy link
Owner Author

Hmm, I wonder if that is because evaluating in a new subprocess does start a new JVM process (thus loading newly depended-upon data-readers), but evaluating inside the existing leiningen one does not.

@xsc
Copy link
Collaborator

xsc commented Oct 28, 2013

Yeah, so, this works:

(set! *data-readers* (#'clojure.core/load-data-readers))
(require 'method.fn)
(map #mf/i toUpperCase ["foo" "bar"]) ;; => ("FOO" "BAR")

I'll see what happens if I use Leiningen's :injections key to let the above call be run on REPL startup. I think it will work but it's a strange hack...

@avescodes
Copy link
Owner Author

@xsc Thanks, I appreciate that you put this together. Despite being kludgy you put it together pretty well. I wonder if we should ping the Leiningen gang on IRC for a smell test?

@xsc xsc closed this as completed in c652ebe Oct 28, 2013
@avescodes
Copy link
Owner Author

Thanks again @xsc, you have been absolutely invaluable in pushing this plugin forward. I have so much respect for the help you've given.

@xsc
Copy link
Collaborator

xsc commented Oct 29, 2013

Thank you, @rkneufeld! I'm glad I could help improving such an awesome project!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants