joker

Discuss all things joker, the Clojure interpreter/linter on top of Go. https://github.com/candid82/joker
jcburley 2018-12-22T03:45:37.001400Z

FWIW, some progress has been made autowrapping Go's std libraries so Joker code can (sometimes clumsily) call them. See https://burleyarch.com/joker/docs/ for the latest list, and see https://github.com/jcburley/joker/issues/6 for a general idea of the status of the project.

jcburley 2018-12-22T14:49:16.002800Z

Okay, I'll look into it further and write up an Issue that explains its utility. My sense if that deftype is described as generating compiled bytecode (in Clojure), because that's an appropriate implementation detail for that host; whereas, in ClojureScript, a different implementation is involved, but a usable subset of both hosts' versions offered with corresponsingly similar descriptions.

jcburley 2018-12-22T15:01:14.003Z

I found a page that describes some of what's going on here, and links to further materials (including a ~38-minute video that I don't think I've watched yet): https://blog.klipse.tech/clojurescript/2016/04/26/deftype-explained.html

jcburley 2018-12-24T02:57:21.003500Z

Ok, having looked through a good amount of material on these facilities, I do not see any of this as needed for Go interop after all! They'd likely be very useful in other situations (though some of their key advantages, around generating performant code at compile/JIT time, do not currently apply to Joker) -- but I don't see that I need any of that to complete the STD work.

jcburley 2018-12-24T02:59:10.003700Z

So: Roman, do you have ideas to share and/or time to devote to adding necessary plumbing to support gostd generating wrappers around STD types, so Joker code can directly access fields in them, invoke methods (receivers) for them, etc.? (I have a few ideas, but don't want to plow ahead without your input, also because I'm not sure they're all that great....)

Candid 2018-12-25T00:46:02.003900Z

my only idea is to create a wrapper around interface{} (so it can hold a value of arbitrary Go type) and use reflection to call methods or access field. Please let me know if you have other ideas.

jcburley 2018-12-22T03:56:03.001600Z

The upshot is that it's wrapping only about 5% of the available functions+methods, due mainly (but not solely) to lack of Joker support for Go types and objects.

jcburley 2018-12-22T03:56:57.001800Z

Still, I think it's past the "proof of concept" point -- it seems like a fairly good approach to getting lots of useful functionality on board, assuming Joker will be adding support for Go (and Joker/Clojure-defined types, per deftype and friends) anyway.

jcburley 2018-12-22T03:59:17.002Z

Is anyone working on adding Go types/objects and/or deftype to Joker? I'd like to try my hand on that, but with a few PRs stacked up (mainly defmulti and then test.joke, which is kinda blocked by no defmulti without being fairly ugly; but also classpath or some similar solution), it's not clear I'm the right person to do that, and there's other work (mainly handling Imports properly) to do to the gostd tool that's needed at some point after types are added -- work for which I'm probably best-suited, when I can find the time.

jcburley 2018-12-22T04:00:14.002200Z

Meanwhile, I'm much closer now to a variant of Joker that meets a substantially greater number of my own use cases, so will be busy working on my own stuff, now that I have a decent, quick-starting, Clojure interpreter!

Candid 2018-12-22T06:30:13.002500Z

Hi James. This is great progress indeed! RE: deftype. My understanding is that it's used for generating new classes (in Clojure proper), not sure how it would help with Go interop. I thought we needed the ability to marshall arbitrary Go types between Go and Joker and support method calling via . notation. It's been a while so I am a bit rusty on the topic. I'd be interested to hear your thoughts.

👍 1