|
Post by Eduardo Julian on Oct 1, 2021 7:31:34 GMT
|
|
|
Post by ahribellah on Oct 6, 2021 22:25:42 GMT
I've been interested in using this for a while now and see that there's a JavaScript backend now. What is the state of interop?
|
|
|
Post by Eduardo Julian on Oct 7, 2021 16:54:32 GMT
As far as interop goes, JVM interop has the most stuff available, though much of it is due to the intricacies and complexities of JVM bytecode, so how much of that is pure undiluted functionality is debatable. Interop for the non-JVM back-ends tends to be much simpler, with just the means to import classes/functions and making (dynamically-typed) functions that you can use as wrappers for Lux's statically-typed functions if you need to give a closure to some foreign code. The JS interop machinery has a few more things than that, but not that much. The current amount of interop machinery seems to be good enough for now, as I've used it to implement the platform-dependent code in the standard library, and it all seems to work just fine. If you want an example of JS interop in action, you can see how I implemented file-system IO in the standard-library for the JavaScript backend: github.com/LuxLang/lux/blob/a8536d6f44345d7ef86cdc9c67e6efbe80f024de/stdlib/source/library/lux/world/file.lux#L303You can also see a much simpler example by reading the tests for JS interop: github.com/LuxLang/lux/blob/a8536d6f44345d7ef86cdc9c67e6efbe80f024de/stdlib/source/test/lux/ffi.js.luxAnd, finally, here's the documentation (although, I can now see there's not a ton of example code in it): github.com/LuxLang/lux/blob/master/documentation/library/standard/js.md#libraryluxffiPlease let me know if there's anything that's confusing or under-explained.
|
|