Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Keep it simple #3

Open
keleshev opened this issue Mar 31, 2013 · 3 comments
Open

Keep it simple #3

keleshev opened this issue Mar 31, 2013 · 3 comments

Comments

@keleshev
Copy link
Member

I'm not sure if it's a good idea to expose so much functionality:

  • docopt.core.docopt
  • docopt.core.match
  • docopt.core.parse

I can understand that compile-time/run-time parsing could be a trade-off, but what one supposed to do with docopt.core.parse?

I wish it was as simple as docopt.docopt as in other implementations, but I can understand that languages, conventions, and needs might be different.

@postamar
Copy link
Contributor

I'm not too sure either, but based on my limited understanding of how things are done in clojure, it's OK. Basically, a consequence of the immutability of clojure data structures is that idiomatic clojure doesn't hide their contents.

To answer your question, you could want to call docopt.core/parse to test the validity of a docstring: it's invalid if it throws an exception. I was thinking of maybe also have it log some warnings. As of now, docopt.core/match is called for testing in the docopt.test_core namespace.

@postamar
Copy link
Contributor

postamar commented Apr 2, 2013

I changed docopt.core a bit and replaced match with a java class method for JVM interop, see README for more info.

@carocad
Copy link

carocad commented Aug 19, 2015

Hey @postamar,
I would like to help with the development of docopt.clj. I am also new to Clojure but I have some ideas of how to improve its simplicity. As some remarks:

;instead of
(defn func-name [])
;use
(defn- func-name [])
;for non-public functions as https://clojuredocs.org/clojure.core/defn-

Also according to this documentation it is not necessary that you put the docstring inside metadata, but rather after the name of the function. It should be automatically recognized.

(defn -main 
"This is my docstring"
[ & args])

As I said, I would like to work on this, but yesterday I tried to modify your code and I couldnt even get the same code on the README to run. Could you please give me a quick overview over what is what there and how to hack into it? :)

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

No branches or pull requests

3 participants