Hacker News new | past | comments | ask | show | jobs | submit login

Can dart be evaluated within the browser? I’ve been looking for a language which can be executed within the browser (without needing a connection to any server).

I would like to write some blog posts explaining technical concepts and provide executable, interactive code. As far as. I can tell, currently JavaScript is the only language for the job. All languages which transpile to js seem to require (out of browser) command line tools




Dart was originally designed as a JS 'replacement', designed to supplant it. The talked about browsers executing it directly, but as a transition step compile-to-JS has always been a first class citizen for Dart.

Now of course no language is going to replace JS, it's going to be compile to WASM or JS, and Dart is now focused on things like Flutter where it is used in a 'Ahead of Time' compiled form.


dart2js tool can be used in the browser, I believe this uses it: https://dartpad.dartlang.org/

It also has dart dev compiler which compiles much faster to more modern JavaScript: https://webdev.dartlang.org/tools/dartdevc


I think probably one of the most advanced languages in that respect is ClojureScript. ClojureScript is fully self hosting and you can 'eval' in the browser.

I don't really use ClojureScript, but it was a milestone that took a couple of years of leg work to get going.

ClojureScript is also in wide production use, I have not seen another compile to JS language that works as well.


dart2js is written in Dart so you can use it to compile itself and then run in browser.


OCaml/ReasonML could be evaluated in browser without a connection to a server. I built this little project to demonstrate the ability: https://sketch.sh


You can use the Typescript transpiler directly in a browser.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: