Which piece of code do you think makes ClojureScript significant?

But for this you would have to compromise somewhere. Why limit yourself like that? The standard library that doesn’t require host interop (ie. immutable collections) is already top-notch. You can’t make a standard library for IO because the platforms vary so immensely in capabilities.

The JVM has threads and can do sync IO just fine. JS doesn’t have threads, sometimes can do IO, sometimes even sync but mostly async. Just having threads is such a gigantic difference that you’d have to take out of the equation for a truly platform agnostic “standard library”. On top of that even the JS runtimes themselves vary greatly in capability. Browser, node, react-native, nashorn and so on.

The reason there is no “standard library” is because it is pretty much impossible to write one. If you wrote one it would just be completely crippled compared to what you could actually be doing. As far as I can tell there are good wrappers for most “native” things so you rarely need to write actual Java or JS. Yes, you still need to be aware of the platform you are on but there is just no way around that. Learning Java and JavaScript will make you a better programmer, even if you just learn why you don’t like them and what not to do.

PS: I think interface in Java is one of its best features. But like all good features you can go overboard with it and the Java world certainly did. Same deal in Clojure(Script) though. You could create a defprotocol for everything or just use functions and maps. Knowing when to use what is the hard part and that is true for every single platform or language I have used ever.

1 Like