JasonSteving99 / claro-lang

Claro Lang
https://docs.clarolang.com
138 stars 10 forks source link

Interop story #47

Open lorefnon opened 4 months ago

lorefnon commented 4 months ago

Hello, thanks for open sourcing claro - this looks quite interesting.

Coming from kotlin, I am curious what is your perspective on interop with other jvm libraries, which I couldn't glean from the docs. Is this something that will be possible and if so, will it require claro wrappers to be authored for individual libraries ? I guess the latter is needed to retain the guarantees claro provides but still curious where this lies in your roadmap.

JasonSteving99 commented 4 months ago

Great question! This is actually something that will take more work to pull off "right" - but it's definitely planned.

For now, Java code can call into Claro code in a fairly straightforward way. The main hurdles are:

In the other direction, Claro's only (current) mechanism for calling into Java directly is restricted to the stdlib's implementation. For example the deque Module exports an opaque newtype mut Deque that is actually just a java.util.ArrayDeque underneath. The reason this isn't exposed to Claro programs outside the stdlib (yet) is because:

All this said, it's very possible that in the future these limitations can be addressed!

swork1 commented 4 months ago

I am excited to see what progress can be made here as interop with current Java libraries will be helpful filling in some "gaps" for now. :) 👍

lorefnon commented 4 months ago

OK, this is great to know. Thanks for sharing your thoughts on this.