@ambrosebs I'm still working on the SciType stuff . Let's continue the conversation in a new sub-thread here. I'm losing track of the long thread with 100+ messages we created :)
I'll wait to test it out when it lands in bb master.
๐งต
@ambrosebs Now pushed babashka SciType branch. Conceptually it works. Need to clean up some details that should not be important to the end result.
user=> (defrecord Foo [])
user.Foo
user=> (instance? sci.lang.SciType Foo)
trueuser=> (defprotocol P (doit [_]))
..
user=> (extend-protocol P sci.lang.SciType (doit [_] :sci-type))
#object[clojure.lang.MultiFn 0x22f50fc5 "clojure.lang.MultiFn@22f50fc5"]
user=> (doit Foo)
:sci-type@ambrosebs Is there a reason we couldn't just have exposed an interface?
user=> (extend-protocol P sci.lang.IVar (doit [_] :sci-typex))
#object[clojure.lang.MultiFn 0x22f50fc5 "clojure.lang.MultiFn@22f50fc5"]
user=> (doit #'inc)
:sci-typexhmm good question
what about CLJS?
nvm I'm getting the platforms confused.
bb doesn't run in cljs ๐
yeah, well, SCI does support JS so it would be good if it worked there too
yes. a deftype seems the most straightforward way to do that perhaps
fair enough
Maybe I should move sci.impl.SciVar to sci.lang too then
in the future, probably not now
enough changes for now :)
ah to expose cross-platform extensions for vars?
but I was also thinking I could map (extend-protocol clojure.lang.Var ...) to sci.impl.SciVar
as clojure vars should never be visibible directly in SCI anyway
ah, news to me!
and such a "polyfill" isn't possible with custom types
I guess you could do this as a SCI user with:
{:classes {'clojure.lang.Var sci.lang.SciVar}}
to do the override automaticallyAnyway, welcome to test out this approach before I merge it
the sci.lang.SciType one I mean
If you need a binary let me know
Do you have a preference naming-wise for sci.lang.Type vs sci.lang.SciType ?
Hmm I couldn't choose ๐
Chicken and egg problem. I'd love to have some feedback before I merge :)
I'll take a look when I can ๐
I'll probably get back to this in the weekend
@ambrosebs has joined the channel