5 ms·
How about just biting the bullet and writing JavaScript? If I decided I wanted to use Delphi, but I didn't like Object Pascal, so I implemented a Scheme over t
by JasonFruit 8y ago
How about just biting the bullet and writing JavaScript?
If I decided I wanted to use Delphi, but I didn't like Object Pascal, so I implemented a Scheme over the top that gave weird deep backtraces with wrong line numbers whenever an error occurred, compiled to a single-line semicolon-delimited mess of unidiomatic Pascal, and often required me to write some Pascal anyway, you'd think I was nuts. Why do we think it's a good idea just because it's in a browser?
JavaScript has its problems, but it's far from the worst language out there. Just write JavaScript already.
- srgpqt 8y agoI think you just described ES6 compiled by Babel pretty well. Most people have gotten used to this disconnect.
- klodolph 8y agoWell, with Babel you at least have source maps so you can get the original source locations in your backtraces.
- Willamin 8y agoThere's nothing stopping other compile-to-javascript languages from having source maps too
- klodolph 8y agoYes, it’s a pretty standard feature which is why it works so well. You can Typescript->ES->bundled ES->bundled minified ES and Chrome will point you directly at the original source in the debugger (once you give it permission).
- innocentoldguy 8y agoOne of the benefits I've seen while using Elm is that you virtually never need browser-based backtraces. The Elm compiler catches everything and has much better error messages, in my opinion.
- krapp 8y agoUnfortunately, that ship sailed long ago, and the javascript community has coalesced around avoiding direct contact with the language at any cost.
- always_good 8y agoWhy is it unfortunate that people improve their tools with things like Elm and Mint? And how is "just use Javascript" a response to that? Seems like yall should first try to understand why people use tools like Elm and Mint instead of assuming it's just some flippant aversion to Javascript?
- krapp 8y agoYou don't need compile-to-js languages to have the benefits that those languages provide. You could validate javascript for correctness and safety directly, or import js libraries which implement "types" which javascript doesn't support (because such types have to be to javascript anyway.) But I think the primary reason to use languages that compile to javascript, rather than tools that work on javascript, is to avoid writing javascript.
- always_good 8y agoThat's like saying you don't need static typing if you just write better code. The primary reason to use other languages is not to avoid Javascript, but to use better tools. I use Elm because it has built-in immutability (JS doesn't), a statically-typed ecosystem (JS' is bolted on in a side channel), a single architecture pattern (vs JS' redux/flux/react/angular/etc). By the time you get static typing, immutability, and an architecture set up in Javascript, you may have taken on a bunch of libraries / moving parts that are more complex that using a different language that comes with all of that out of the box. Saying I'm just trying to avoid Javascript suggests misunderstanding.
- cprecioso 8y agoI see your point, but I also think a smaller, more focused language can be useful for teams; in order to enforce best practices. Think Elm: it's impossible to produce side-effects or mutate objects, cause the language simply does not have the facilities to do so. The guarantees Elm gives you would be hard to maintain if it was just a library which had to deal with JS's constant dynamicness. Moreover this guarantees do not only improve developer experience; but also compiler optimizations.
- wtetzner 8y agoThe difference is that there's no other way to target the browser. With your Delphi example, you could just use a Scheme implementation that targets the same platform. With the browser, JS is the only way to run code. That's starting to change with WASM, but it'll be while before it can be used for everything JS is used for.
- CJefferson 8y agoOn the other hand, i could rewrite your comment about assembler, in the early days of C and B and the like. As source maps and debugging get better, we get closer to being able to ignore the javascript.