Fork me on GitHub
#planck
<
2017-04-10
>
slipset19:04:47

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

slipset19:04:27

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

anmonteiro19:04:10

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

mfikes19:04:14

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

anmonteiro19:04:35

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

anmonteiro19:04:40

but it can for the merge symbol

mfikes19:04:12

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

slipset19:04:18

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

anmonteiro19:04:36

which is not how the Clojure REPL works

anmonteiro19:04:45

and both Planck and Lumo wanna have parity with it

mfikes19:04:19

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

anmonteiro19:04:41

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

slipset19:04:47

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

mfikes19:04:04

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?

anmonteiro19:04:36

I don’t know what get-arglists is 🙂

mfikes19:04:48

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

slipset19:04:19

It’s not in Clojure AFAIK

mfikes19:04:20

Maybe it wasn't intended to be public?

anmonteiro19:04:32

that’s something @richiardiandrea worked on

mfikes19:04:44

Ahh, that guy. Hmm 🙂

anmonteiro19:04:09

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

anmonteiro19:04:17

I didn’t recall that was in Lumo 🙂

slipset19:04:21

which is where all this comes from 🙂

mfikes19:04:34

Ahh, Emacs needs it?

slipset19:04:54

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

richiardiandrea19:04:56

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

mfikes19:04:09

Ahh, cool.

mfikes19:04:34

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

slipset19:04:02

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

mfikes19:04:46

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

mfikes19:04:38

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

mfikes19:04:53

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

slipset19:04:05

yes, I’m looking into it 🙂

mfikes19:04:10

Ahh. Coolio 🙂

slipset19:04:14

seems to work

mfikes19:04:45

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

richiardiandrea19:04:01

Don't copy it because there is a bug 😄

mfikes19:04:23

High fidelity including bugs

richiardiandrea19:04:24

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

richiardiandrea19:04:41

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

richiardiandrea19:04:58

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

richiardiandrea19:04:14

but I haven't had time to contribute it

mfikes19:04:52

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

mfikes19:04:42

Ahh, doc deals with that case

richiardiandrea19:04:58

yep exactly that piece

richiardiandrea19:04:23

so I need to add that if in get-arglists

mfikes19:04:52

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

richiardiandrea19:04:35

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

richiardiandrea19:04:12

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

mfikes19:04:34

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

slipset19:04:45

hmm, the lumo version doesn’t work for if

slipset19:04:01

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

slipset19:04:36

and I kind’a see why.

mfikes19:04:33

doc has special handling for special forms, evidently

slipset20:04:28

yes, I saw that.

anmonteiro20:04:35

@slipset thanks, can you fix the indentation though?

mfikes20:04:13

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

mfikes20:04:25

(In case you didn't know.)

mfikes20:04:00

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

anmonteiro20:04:00

he probably needs to set user.email in .gitconfig

anmonteiro20:04:08

to an email that GitHub knows about

slipset20:04:36

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

slipset20:04:55

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

mfikes20:04:00

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

slipset20:04:20

It’s no big deal.

mfikes20:04:12

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

slipset20:04:08

If it’s no biggie for you, it would be nice with “<mailto:[email protected]|[email protected]>”

mfikes20:04:47

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

anmonteiro20:04:48

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

anmonteiro20:04:58

though that might not be something you wanna do

mfikes20:04:09

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

slipset20:04:29

then I’ll just do that.

anmonteiro20:04:35

I think that’ll fix it in a backwards manner

mfikes20:04:42

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

anmonteiro20:04:18

interestingly your commit to Lumo is identified correctly

slipset20:04:21

@anmonteiro because I amended it 🙂

slipset20:04:16

Jepps, and it works backwardly 🙂