Fork me on GitHub
#joker
<
2020-04-27
>
jcburley07:04:44

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.

👍 8
myguidingstar12:04:08

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

myguidingstar13:04:42

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/+

jcburley18:04:19

(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. 😲)

borkdude19:04:39

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.

borkdude19:04:21

and btw, I realize this is much easier:

user=> `+
joker.core/+

jcburley19:04:04

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.

jcburley19:04:28

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.

jcburley19:04:16

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]

jcburley19:04:39

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

jcburley19:04:30

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?

borkdude19:04:16

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.

👍 4
borkdude19:04:09

but I would say that is not a public Clojure API

jcburley19:04:41

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

borkdude19:04:09

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

👍 4
borkdude19:04:19

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.

😲 4