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.
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.
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
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.
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....)
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.
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.
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.
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.
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!
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.