This thread came up right around the time I was considering adding a
dependency on rhizome to instaparse to make it easy to visualize the parse
trees. Based on the discussion here, I decided it would be a bad idea to
include rhizome directly in instaparse's dependencies. Nevertheless, it
made sense to enable the "visualize" function *provided* rhizome was
already in the user's dependencies. More specifically, it will use
whichever version of rhizome they choose to put in their dependencies, thus
a version conflict is not an issue.
I found a technique to achieve this effect, and wanted to report on it here.
First, towards the top of the file, after the namespace declaration, I
included the following:
(try
(require '[rhizome.viz :as r])
(catch Exception e
(require '[instaparse.viz-not-found :as r])))
This sets things up so r/ refers either to the rhizome.viz namespace, or if
it is not installed, my dummy instaparse.viz-not-found namespace. The
instaparse.viz-not-found contains stubs for all the functions from rhizome
that I use; the stubs simply throw a friendly error message saying to add
rhizome to the project's dependencies.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.