clio-lang / clio

Clio is a functional, parallel, distributed programming language.
https://clio-lang.org
Apache License 2.0
935 stars 30 forks source link

Discuss C/C++ Implementation #135

Open garritfra opened 4 years ago

garritfra commented 4 years ago

We should discuss a way to use native code for bottleneck functions.

Related

garritfra commented 4 years ago

https://medium.com/@atulanand94/beginners-guide-to-writing-nodejs-addons-using-c-and-n-api-node-addon-api-9b3b718a9a7f

kination commented 4 years ago

Seems Rust is being used for compiling...than isn't it okay to use Rust for native binding? https://github.com/neon-bindings/neon

This is just a question...I'm new in here.

garritfra commented 4 years ago

Hi @djKooks! I have tried using Rust with Neon in a small codelab a few days ago (#131), and it worked like a charm. The thing thats holding us back is that if we use rust in our project, the user will need to have the rustc installed on their system, which can be confusing for some people. Another solution would be to build and publish the binaries for every platform via CI, and then downloading it conditionally after installing clio. I think you can see the issues with that :) As much as we'd love to use rust in this project, its not yet suitable for npm packages that will be used on multiple platforms.

Virtually any system has a C/C++ compiler preinstalled, so we can more or less safely assume that we can compile native C++ modules on install-time. Thats why we chose this path for the future.

kination commented 4 years ago

@garritfra seems right~thanks for comment 🙏

garritfra commented 4 years ago

I started working on an experimental Rust implementation for clio: https://github.com/clio-lang/rio

I'm still trying to evaluate some crates for parser implementations. Feel free to share your thoughts!

kination commented 4 years ago

@garritfra great! Is rio to replace pacakges/core/part of this repository?

garritfra commented 4 years ago

I don't think so. At least not anytime soon. If we decide to use rust, we'd probably have to move away from npm, and instead go for a release approach (Something like rustup would be great). But for now, we will stick to npm for the sake of simplicity. We're still in an early state of development.

pouya-eghbali commented 4 years ago

Afaik, LLVM can compile to JavaScript / WASM, and native binaries / machine code. Should we probably discuss targeting LLVM and moving away from node.js?

kination commented 4 years ago

Seems this project are focused on 'take advantage of multiple CPUs and CPU cores (parallelism)', maybe you need to think about moving on...(not sure what will be the best option...)