joker

Discuss all things joker, the Clojure interpreter/linter on top of Go. https://github.com/candid82/joker
jcburley 2020-04-27T07:48:44.027900Z

Some “fun” news on https://github.com/jcburley/joker`gostd`https://github.com/jcburley/joker: • I pushed some significant changes a week or so ago -- but there’s much to be done, and I’m rethinking how to do that to make (at least portions of) it more palatable for eventual incorporation into official Joker • Last night, I used it to send my first email (via SMTP) -- an entirely empty one, though -- via Joker, as described in https://github.com/jcburley/joker/blob/gostd/GOSTD.md`GOSTD.md`https://github.com/jcburley/joker/blob/gostd/GOSTD.md • It’s looking more and more like this fork has exposed https://stackoverflow.com/questions/61342000/why-might-exec-command-start-hang-on-darwin: some kind of race condition, perhaps? So, while it’s hardly ready for “prime time” and is likely to undergo some substantial changes to its public-facing functionality, it’s still kinda percolating along, and bearing at least a little fruit.

👍 2
2020-04-27T12:18:08.028700Z

is there anything like clojure.main/demunge in joker?

2020-04-27T13:10:42.030500Z

what I want is to have a function (not a macro!) that receive a function object and possibly return that object's symbol. Eg (find-the-sym +) => joker.core/+

jcburley 2020-04-27T18:59:19.032500Z

(Okay, it’s pretty freaky watching someone else’s comments get added and deleted LIVE while looking at my Slack window!! I know Slack supports deletion, just hadn’t seen it happen like that before. 😲)

borkdude 2020-04-27T19:06:39.033100Z

I typed this:

(defn resolved-name [sym]
  (when-let [res (resolve sym)]
    (let [m (meta res)]
      (symbol (str (ns-name (:ns m))) (str (:name m))))))

user=> (resolved-name '+)
joker.core/+
but then removed it as I realized this is not the same as passing the function object.

borkdude 2020-04-27T19:07:21.034200Z

and btw, I realize this is much easier:

user=> `+
joker.core/+

jcburley 2020-04-27T19:08:04.035Z

Yeah, I saw it and it was a good attempt, and I understood why you removed it. It was a new experience to me (in a chat channel, versus a shared doc being edited) watching it un-render itself.

jcburley 2020-04-27T19:15:28.037Z

Anyway, Fn in Joker has a MetaHolder field, but it’s typically nil. One must have the (var …) for it to get at the actual metadata. I don’t know offhand whether it’s feasible for Joker to put something helpful in the Fn.MetaHolder field, nor what exactly Clojure is doing here.

jcburley 2020-04-27T19:17:16.037900Z

One of the changes I made, to support faster initialization, was to “decorate” built-in (`Proc`) functions so they show their own names. E.g.:

user=> cons
#object[Proc:procCons]

jcburley 2020-04-27T19:17:39.038600Z

(It used to return just #object[Proc].)

jcburley 2020-04-27T19:19:30.040Z

Possibly Joker could, a la Clojure, return more info than just #object[Fn] when stringizing a function. From there, a joker.repl/demunge function might be worth creating? Not sure offhand re the use cases for any of this though…maybe someone could Issue this and explain?

borkdude 2020-04-27T19:20:16.040500Z

I know one use case in clojure spec where they try to reverse engineer a printed spec message from a function name. Let me look it up.

👍 1
borkdude 2020-04-27T19:21:09.041300Z

but I would say that is not a public Clojure API

jcburley 2020-04-27T19:23:41.042300Z

Not in and of itself, and Joker doesn’t (yet) support Spec, but isn’t Specize ’s Object (which calls fn-sym) public?

borkdude 2020-04-27T19:26:09.042900Z

yes, but their implementation is probably relying on something that the community should not use - maybe. worth asking in #clojure

👍 1
borkdude 2020-04-27T19:27:19.043900Z

btw, I have a version of spec that runs with babashka. https://github.com/borkdude/spartan.spec it is .cljc. I'm open to receiving PRs to make it compatible with joker via a :joker conditional.

😲 1