Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interop story #47

Open
lorefnon opened this issue Feb 29, 2024 · 3 comments
Open

Interop story #47

lorefnon opened this issue Feb 29, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@lorefnon
Copy link

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
Copy link
Owner

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:

  • the namespacing/naming of the Claro code you're calling into is funky because Claro doesn't use Java's "package" namespacing system
  • manually constructing non-primitive data to pass to Claro procedures is currently very annoying and technically unsafe (you could break Claro's type system rules)

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!

@JasonSteving99 JasonSteving99 added the enhancement New feature or request label Mar 2, 2024
@swork1
Copy link
Contributor

swork1 commented Mar 2, 2024

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
Copy link
Author

lorefnon commented Mar 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants