koka icon indicating copy to clipboard operation
koka copied to clipboard

Consider better Javascript Supports

Open Lucifier129 opened this issue 5 years ago • 5 comments

Hi!

Koka is an excellent language that supports algebraic-effects. Great Job!

Recently, I wrote a simple canvas demo via Koka v1.0. I know Koka v2.0 now is under development, just leave my wishlist here for better javascript supports.

  • use ES modules instead of AMD and requirejs

  • better TypeScript supports. eg. generate *.d.ts

  • better VSCode supports. now there is a vs-code extension just for syntax-highlighting

  • WASM supports. Koka v2 without needing a garbage collector or runtime system is suitable for WASM.

  • an npm package for nodejs api like esbuild for better integrating with other build tools

  • JSX supports. Algebraic Effects is perfectly fit for UI development and JSX can improve the readability

  • and so on...

I believe Koka can be a good competitor for rescript, purescript, and elm if there is better support for JavaScript:)

Lucifier129 avatar Nov 03 '20 09:11 Lucifier129

LGTM

zzj3720 avatar Nov 03 '20 09:11 zzj3720

LGTM

sinoon avatar Nov 03 '20 10:11 sinoon

Thanks for the feedback! Currently I am mostly focused on the C backend for best performance but keeping the JavaScript backend up-to-date. Some thoughts:

  • It should be not to hard to generate ES modules and perhaps even typescript -- all the code is in src/Backend/Js/FromCore.hs.
  • VS code syntax highlighting should be there soonish -- it should be easy to port the support/atom/grammars/koka.json file to vscode.
  • WASM: that is definitely a goal and it should be not too hard by starting from the C backend. I am on the WASM design committee now and seeing if we can extend WASM to offer more efficient algebraic effect support.
  • I really like that Koka is portable enough to easily run it natively compiled (through C) or in the browser/node (with JS). However, integration with other JS libraries is generally hard as Koka is strictly typed while JS is dynamic -- this may be difficult with the JSX case (but I have not looked into it)

daanx avatar Nov 11 '20 21:11 daanx

I might want to tackle some of the JS issues but I'm having trouble getting the interactive JS console to run, are there any docs on doing that? I'm getting weird assert errors (the default C backend works in interactive mode). Thanks!

alongalky avatar Jan 28 '21 22:01 alongalky

@alongalky Are you still getting these errors? For me the Javascript console works normally, so if you encounter anything unusual feel free to open an issue :)

anfelor avatar Jun 17 '21 11:06 anfelor