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

> ClojureScript is a compiler for Clojure that targets JavaScript. [1]

If ClojureScript is compiled, why can't WASM be the same?

[1] https://clojurescript.org/




In clojurescript you can press your slime or calva keystroke to send a form (or an expression from a rich comment) to the browser repl and see that immediately reflect and use the current state of the app without reloading.

What’s the equiv workflow when compiling to wasm? Save file > compile > hot reload? > reconstruct state somehow?

Is it like clojurescript where you interactively work on the app in the same way you might interactively craft a sql statement in a live db?


In Rust, no clue because I've never tried. However, I did find a hot reload of WASM compiled from C++ [1]. If they're not equivalent, I would imagine it's a matter of ecosystem maturity rather than it being impossible.

Realistically, hot reload is going to be something like inotify(7) hooked into a compiler and whatever it takes to reload seamlessly. If it's been solved in one general purpose language, it's likely to be possible in another.

[1] https://visualstudiomagazine.com/articles/2021/07/29/cpp-hot...


You can definitely hot reload in rust: https://fasterthanli.me/articles/so-you-want-to-live-reload-... (this person's blog is one of my fav's, i know that's a huge post but he covers everything really well).

But this is missing the difference.

When we say hot reload in javascript (or even better, hot module replacement) or java or rust or c++, there's usually annoying limitations like you can't change the arity of a function or you have to pause all the threads or you need some mechanism to reset state to a known good starting point because we just broke it (potentially).

The difference with a lisp is that you don't need do any of that. You replace the function object in the system image (atomically) and you crack on like nothing happened. No waiting around, no rerunning state into the app. And you triggered it just from a keystroke in your editor.

The developer experience is unparalleled.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: