Since I’m asking the question, I’m probably not gonna understand the answer, but I’ll try anyways:
Why are the functions in planck.repl.cljs mostly private and exposed through macros in the repl.clj namespace?
@slipset because you wanna call (doc merge)
for example
@slipset planck.repl
is a conflation of stuff needed to actually implement the REPL, and a namespace that is an appropriate home for imitations of stuff in clojure.repl
The few things that are public are indeed macros. I think that they in turn delegate to functions is just a matter if implementation choice for those macros.
and a function wouldn’t know how to get the docstring for the merge function
but it can for the merge
symbol
And, conversely, the doc
macro could probably have all of its implementation within it and not call the doc*
function.
@anmonteiro so, otherwise you’d have to call (doc 'merge)
yeah
which is not how the Clojure REPL works
and both Planck and Lumo wanna have parity with it
cool.
Yeah, I think all of the public things in planck.repl
are macros (some started off inappropriately being REPL specials, FWIW)
@slipset I think that implementation won’t work for macros
@anmonteiro you’re right:
cljs.user=> (planck.repl/get-arglists get-arglists)
Could not eval (var get-arglists)
Unable to resolve var: get-arglists in this context
nil
cljs.user=> (planck.repl/get-arglists println)
([& objs])
cljs.user=>
I forget, where did this get-arglists
thing come from. Was it something you made up @anmonteiro, or is it in Clojure or ClojureScript somewhere?
I don’t know what get-arglists
is 🙂
cljs.user=> (doc lumo.repl/get-arglists)
-------------------------
lumo.repl/get-arglists
([s])
Return the argument lists for the given symbol as string.
https://github.com/anmonteiro/lumo/blob/master/src/cljs/snapshot/lumo/repl.cljs#L858
It’s not in Clojure AFAIK
Maybe it wasn't intended to be public?
oh
that’s something @richiardiandrea worked on
Ahh, that guy. Hmm 🙂
I think that’s needed for inf-clojure
for some reason
I didn’t recall that was in Lumo 🙂
which is where all this comes from 🙂
Ahh, Emacs needs it?
since when I added planck support for inf-clojure, I saw that lumo and stock clojure had something for this, but planck was lacking.
yeah exactly for inf-clojure
, it kind of exposes the arglists that then we display as Eldoc at the bottom
Ahh, cool.
Does inf-clojure
do things in another way when using a regular ClojureScript REPL?
(defcustom inf-clojure-arglists-form
"(try
(:arglists
(clojure.core/meta
(clojure.core/resolve
(clojure.core/read-string \"%s\"))))
(catch Throwable t nil))\n"
"Form to query inferior Clojure for a function's arglist."
:type 'string
:package-version '(inf-clojure . "2.0.0"))
Ahh, right, Clojure is available in JVM ClojureScript...
FWIW, it makes sense to add it to Planck for the same reasons it was added to Lumo
@slipset I wonder if Planck's get-arglists can be a copy of Lumo's implementation
yes, I’m looking into it 🙂
Ahh. Coolio 🙂
seems to work
Cool. Yeah, they both have the same resolve-var
impl 🙂
Don't copy it because there is a bug 😄
Oh. Hah!
High fidelity including bugs
so basically sometimes we see (quote (.....)
cljs.user=> (lumo.repl/get-arglists "defn")
(quote ([name doc-string? attr-map? [params*] prepost-map? body] [name doc-string? attr-map? ([params*] prepost-map? body) + attr-map?]))
with Antonio we kind of found out we need an if
in there
but I haven't had time to contribute it
Interesting. doc
has a similar construct, and in the end it works for defn
https://github.com/mfikes/planck/blob/master/planck-cljs/src/planck/repl.cljs#L1315
Ahh, doc deals with that case
https://github.com/mfikes/planck/blob/master/planck-cljs/src/planck/repl.cljs#L1252-L1259
yep exactly that piece
so I need to add that if
in get-arglists
Nice. Yeah. I suppose doc could rely on get-arglists
if it has all the funky logic in it
definitely I am going to see if I have some time these days for patching 😄
I have a bug in inf-clojure
to fix first I guess, kind of nasty
I wonder if this was when ClojureScript first got doc
support: http://swannodette.github.io/2014/12/29/nodejs-of-my-dreams
hmm, the lumo version doesn’t work for if
planck.repl=> (resolve-var <@U095WMJNR>/*compiler* (first (repl-read-string "if")))
and I kind’a see why.
doc
has special handling for special forms, evidently
yes, I saw that.
@slipset thanks, can you fix the indentation though?
@slipset Your commits are going in under a different identity.
(In case you didn't know.)
Perhaps they are just going in under your work email address.
he probably needs to set user.email
in .gitconfig
to an email that GitHub knows about
@mfikes: thanks. Yeah, that’s my work address.
I always struggle with that, which address to set globally 😞
Let me know if you need me to roll back the Planck commits. I don't think anyone else has pulled them yet.
It’s no big deal.
Ok, up to you. I could remove them with a force push.
If it’s no biggie for you, it would be nice with “<mailto:erik@assum.net|erik@assum.net>”
I'll remove them and we can sort out how to re-add your three commits.
@slipset FWIW I think you can fix it by adding your work email to your GH account
though that might not be something you wanna do
Yeah, I have my work and non-work all associated with the same GitHub account.
ah, nice!
then I’ll just do that.
I think that’ll fix it in a backwards manner
In GitHub you can associate any number of email addresses with that single identity.
interestingly your commit to Lumo is identified correctly
@anmonteiro because I amended it 🙂
ah 🙂
Jepps, and it works backwardly 🙂
nice
thanks
np