planck

Planck ClojureScript REPL
slipset 2017-04-10T19:16:47.807110Z

Since I’m asking the question, I’m probably not gonna understand the answer, but I’ll try anyways:

slipset 2017-04-10T19:17:27.820998Z

Why are the functions in planck.repl.cljs mostly private and exposed through macros in the repl.clj namespace?

anmonteiro 2017-04-10T19:20:10.873932Z

@slipset because you wanna call (doc merge) for example

mfikes 2017-04-10T19:20:14.875017Z

@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.

anmonteiro 2017-04-10T19:20:35.882329Z

and a function wouldn’t know how to get the docstring for the merge function

anmonteiro 2017-04-10T19:20:40.884034Z

but it can for the merge symbol

mfikes 2017-04-10T19:21:12.894237Z

And, conversely, the doc macro could probably have all of its implementation within it and not call the doc* function.

slipset 2017-04-10T19:21:18.896624Z

@anmonteiro so, otherwise you’d have to call (doc 'merge)

anmonteiro 2017-04-10T19:21:21.897903Z

yeah

anmonteiro 2017-04-10T19:21:36.902881Z

which is not how the Clojure REPL works

anmonteiro 2017-04-10T19:21:45.905979Z

and both Planck and Lumo wanna have parity with it

slipset 2017-04-10T19:21:49.906991Z

cool.

slipset 2017-04-10T19:21:57.909672Z

https://github.com/mfikes/planck/pull/486

mfikes 2017-04-10T19:22:19.917136Z

Yeah, I think all of the public things in planck.repl are macros (some started off inappropriately being REPL specials, FWIW)

anmonteiro 2017-04-10T19:22:41.924639Z

@slipset I think that implementation won’t work for macros

slipset 2017-04-10T19:23:44.945771Z

@anmonteiro you’re right:

slipset 2017-04-10T19:23:47.946837Z

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=>

mfikes 2017-04-10T19:25:04.972476Z

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?

anmonteiro 2017-04-10T19:25:36.983388Z

I don’t know what get-arglists is 🙂

mfikes 2017-04-10T19:25:48.987594Z

cljs.user=> (doc lumo.repl/get-arglists)
-------------------------
lumo.repl/get-arglists
([s])
  Return the argument lists for the given symbol as string.

slipset 2017-04-10T19:26:19.997779Z

It’s not in Clojure AFAIK

mfikes 2017-04-10T19:26:20.998130Z

Maybe it wasn't intended to be public?

anmonteiro 2017-04-10T19:26:25.999936Z

oh

anmonteiro 2017-04-10T19:26:32.002125Z

that’s something @richiardiandrea worked on

mfikes 2017-04-10T19:26:44.005862Z

Ahh, that guy. Hmm 🙂

anmonteiro 2017-04-10T19:27:09.014019Z

I think that’s needed for inf-clojure for some reason

anmonteiro 2017-04-10T19:27:17.016918Z

I didn’t recall that was in Lumo 🙂

slipset 2017-04-10T19:27:21.018148Z

which is where all this comes from 🙂

mfikes 2017-04-10T19:27:34.022395Z

Ahh, Emacs needs it?

slipset 2017-04-10T19:27:54.029308Z

since when I added planck support for inf-clojure, I saw that lumo and stock clojure had something for this, but planck was lacking.

richiardiandrea 2017-04-10T19:27:56.029992Z

yeah exactly for inf-clojure, it kind of exposes the arglists that then we display as Eldoc at the bottom

mfikes 2017-04-10T19:28:09.034057Z

Ahh, cool.

mfikes 2017-04-10T19:28:34.042456Z

Does inf-clojure do things in another way when using a regular ClojureScript REPL?

slipset 2017-04-10T19:29:02.051966Z

(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"))

mfikes 2017-04-10T19:29:46.066648Z

Ahh, right, Clojure is available in JVM ClojureScript...

mfikes 2017-04-10T19:30:38.084314Z

FWIW, it makes sense to add it to Planck for the same reasons it was added to Lumo

mfikes 2017-04-10T19:33:53.150353Z

@slipset I wonder if Planck's get-arglists can be a copy of Lumo's implementation

slipset 2017-04-10T19:34:05.154359Z

yes, I’m looking into it 🙂

mfikes 2017-04-10T19:34:10.155903Z

Ahh. Coolio 🙂

slipset 2017-04-10T19:35:14.177184Z

seems to work

mfikes 2017-04-10T19:35:45.188097Z

Cool. Yeah, they both have the same resolve-var impl 🙂

richiardiandrea 2017-04-10T19:36:01.193273Z

Don't copy it because there is a bug 😄

mfikes 2017-04-10T19:36:08.195675Z

Oh. Hah!

mfikes 2017-04-10T19:36:23.200742Z

High fidelity including bugs

richiardiandrea 2017-04-10T19:36:24.201078Z

so basically sometimes we see (quote (.....)

richiardiandrea 2017-04-10T19:37:41.226154Z

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?]))

richiardiandrea 2017-04-10T19:37:58.231534Z

with Antonio we kind of found out we need an if in there

richiardiandrea 2017-04-10T19:38:14.236485Z

but I haven't had time to contribute it

mfikes 2017-04-10T19:39:52.268869Z

Interesting. doc has a similar construct, and in the end it works for defn

mfikes 2017-04-10T19:40:42.285194Z

Ahh, doc deals with that case

richiardiandrea 2017-04-10T19:40:58.290334Z

yep exactly that piece

richiardiandrea 2017-04-10T19:41:23.298095Z

so I need to add that if in get-arglists

mfikes 2017-04-10T19:41:52.307272Z

Nice. Yeah. I suppose doc could rely on get-arglists if it has all the funky logic in it

richiardiandrea 2017-04-10T19:42:35.321270Z

definitely I am going to see if I have some time these days for patching 😄

richiardiandrea 2017-04-10T19:43:12.333121Z

I have a bug in inf-clojure to fix first I guess, kind of nasty

mfikes 2017-04-10T19:46:34.401517Z

I wonder if this was when ClojureScript first got doc support: http://swannodette.github.io/2014/12/29/nodejs-of-my-dreams

slipset 2017-04-10T19:55:45.587893Z

hmm, the lumo version doesn’t work for if

slipset 2017-04-10T19:56:01.593233Z

planck.repl=&gt; (resolve-var <@U095WMJNR>/*compiler* (first (repl-read-string "if")))

slipset 2017-04-10T19:58:36.646553Z

and I kind’a see why.

mfikes 2017-04-10T19:59:33.666932Z

doc has special handling for special forms, evidently

slipset 2017-04-10T20:00:28.688156Z

yes, I saw that.

slipset 2017-04-10T20:00:37.691317Z

btw https://github.com/anmonteiro/lumo/pull/123

anmonteiro 2017-04-10T20:11:35.916480Z

@slipset thanks, can you fix the indentation though?

mfikes 2017-04-10T20:19:13.067628Z

@slipset Your commits are going in under a different identity.

mfikes 2017-04-10T20:19:25.071510Z

(In case you didn't know.)

mfikes 2017-04-10T20:23:00.142916Z

Perhaps they are just going in under your work email address.

anmonteiro 2017-04-10T20:24:00.162647Z

he probably needs to set user.email in .gitconfig

anmonteiro 2017-04-10T20:24:08.165413Z

to an email that GitHub knows about

slipset 2017-04-10T20:24:36.174860Z

@mfikes: thanks. Yeah, that’s my work address.

slipset 2017-04-10T20:24:55.181097Z

I always struggle with that, which address to set globally 😞

mfikes 2017-04-10T20:25:00.182867Z

Let me know if you need me to roll back the Planck commits. I don't think anyone else has pulled them yet.

slipset 2017-04-10T20:26:20.209384Z

It’s no big deal.

mfikes 2017-04-10T20:27:12.226347Z

Ok, up to you. I could remove them with a force push.

slipset 2017-04-10T20:28:08.244681Z

If it’s no biggie for you, it would be nice with “<mailto:erik@assum.net|erik@assum.net>”

mfikes 2017-04-10T20:28:47.258043Z

I'll remove them and we can sort out how to re-add your three commits.

anmonteiro 2017-04-10T20:28:48.258263Z

@slipset FWIW I think you can fix it by adding your work email to your GH account

anmonteiro 2017-04-10T20:28:58.261684Z

though that might not be something you wanna do

mfikes 2017-04-10T20:29:09.264952Z

Yeah, I have my work and non-work all associated with the same GitHub account.

slipset 2017-04-10T20:29:16.267530Z

ah, nice!

slipset 2017-04-10T20:29:29.271780Z

then I’ll just do that.

anmonteiro 2017-04-10T20:29:35.273878Z

I think that’ll fix it in a backwards manner

mfikes 2017-04-10T20:29:42.276087Z

In GitHub you can associate any number of email addresses with that single identity.

anmonteiro 2017-04-10T20:30:18.288881Z

interestingly your commit to Lumo is identified correctly

slipset 2017-04-10T20:31:21.310223Z

@anmonteiro because I amended it 🙂

anmonteiro 2017-04-10T20:32:09.325936Z

ah 🙂

anmonteiro 2017-04-10T20:32:15.327907Z

https://github.com/mfikes/planck/commits/master

slipset 2017-04-10T20:32:16.328644Z

Jepps, and it works backwardly 🙂

anmonteiro 2017-04-10T20:32:19.329453Z

nice

slipset 2017-04-10T20:32:23.330957Z

thanks

anmonteiro 2017-04-10T20:32:26.332035Z

np