5 ms·
I can't believe people still bash JavaScript. I've used a lot of different languages including Java, C#, C++, AVR Assembly, Python and others but JavaScript is
by jondubois 11y ago
I can't believe people still bash JavaScript.
I've used a lot of different languages including Java, C#, C++, AVR Assembly, Python and others but JavaScript is my favourite and I would not want to go back.
I think its a shame that some people just didn't seriously try JavaScript. It's a very powerful, expressive language.
Also, testing with JS is amazing - Especially unit testing on Node.js. It lets you do stuff like redefine entire objects, properties or methods at runtime (for stubbing).
Also, JS is great for writing asynchronous logic.
- cballard 11y agoI've tried JavaScript, and I decided I preferred type safety. This kind of thing: > It lets you do stuff like redefine entire objects, properties or methods at runtime Sounds horrifying to me, because, as in Ruby[1], library authors will decide that's a good idea. Typeclasses/protocols solve this problem perfectly, while maintaining type safety. [1]: for some reason, this seems to be less of an issue in Python and Obj-C, even though it's totally doable?
- vardump 11y agoIf type safety is what you miss, why not to use some transpiler like TypeScript? http://www.typescriptlang.org/Tutorial http://www.typescriptlang.org/Tutorial
- cballard 11y agoThen you're not writing JavaScript, which was OP's concern. TypeScript is fine (although Elm, Swift, and Haskell are more interesting, IMO).
- 1ris 11y agoLook at purescript. In order to install this madness you need to install not less than 5 package managers, but you might like it.
- purescript 11y agoThe situation has improved since cabal install was required. npm install -g pulp purescript should be enough now.
- deleted 11y ago[deleted]
- vardump 11y agoTypeScript is very close to normal JavaScript. It's basically just JavaScript + type annotations which a compiler can check. Compilation phase removes the annotations, after that point it is pure JavaScript. How are Swift and Haskell relevant for client side web development? Edit: Removed Elm
- the_gipsy 11y agoElm's only target is the browser/JS.
- vardump 11y agoI stand corrected. Never heard of Elm before, but I assumed from context it's non-JavaScript targeting language like Swift and Haskell.
- cies 11y agoAre you aware of GHCJS, Haskell-to-JS, compiler? In the new and rather popular "build/dependency manager"[1] for Haskell, named Stack, you can now quite easily install this compiler. And I think it is only a matter of time till someone writes a Swift-to-JS compiler (Apple might already have it on it's radar). [1]: I know it is not a "build/dependency manager", but I don't know how to call better in for sake of this discussion.
- orangecat 11y agoI can't believe people still bash JavaScript. I can't believe people actually like it. It might be understandable if you're comparing it to enterprisey Java, but I'm baffled that anyone could prefer ES5 to Python or Ruby. (I will acknowledge that ES6 puts it somewhere in the area of Python 2.5). It's an incredibly powerful, expressive language. Not if you want super advanced features like a hashtable with non-string keys, or checking if two objects are equal. It lets you do stuff like redefine entire objects, properties or methods at runtime (for stubbing). As does any other dynamic language. Also, JS is great for writing asynchronous logic. As is any other language with first-class functions. And with others you don't have to do silly contortions to work around JavaScript's broken "this". I think its a shame that some people just didn't seriously try JavaScript. Tried it, have written it professionally for many years, and as a result am very much looking forward to WebAssembly.
- spion 11y agoAn interesting aspect which JS has and other languages don't is the "objects are hashes" notion. Combined with TypeScript / Elm / PureScript's ability to write and check the types of these (especially Elm before the refactor that removed the add/delete field features), this is very powerful. I often wish Haskell's built in records were as powerful as Elm's / PureScript's, but wonder if thats doable in an efficient way without the JIT logic in engines like V8. Also, there is something to the whole "modules are records/hashes" idea which is quite elegant, IMO. I'm not sure why we still put up with the idea that the module system needs to be a whole different language with different rules. But I'm not sure if there is a type system capable of modelling this very well.
- zeveb 11y ago> I can't believe people still bash JavaScript. == vs === !== hasOwnProperty > Also, testing with JS is amazing - Especially unit testing on Node.js. It lets you do stuff like redefine entire objects, properties or methods at runtime (for stubbing). Doable in Common Lisp for 21 years… > Also, JS is great for writing asynchronous logic. ITYM JavaScript has first-class functions. So does Lisp, so does Python, so does Go…
- 1ris 11y agoIt's not a bad language, but it's not good either. But who is it powerfull? It's a very poor man's scheme, and scheme is not powerfull either. If javascript has anything to over it's IMO simplity and not power. But I'll never understand who thought this asynchronous API was a good idea. I just wanted to draw pictures in a canvas _in order_, because they should overlap. A common task you could mean. I ended up building a monadic builder for callback chains, that creates a javascript string that is evaled. I felt like this language and the api was incredibly cumbersome, minimalistic and limited. It lacks a blocking api, monad support, dsl support, macros and lazy evalution. But mayme there is a simple solution to that, that I'm not aware of.
- wtetzner 11y ago> scheme is not powerfull either In what sense is Scheme not powerful? It has TCO, syntax-rules, call/cc, etc. Of course, all of those are things scheme has that JavaScript doesn't.
- 1ris 11y agoNo types, a very minimal syntax, a standard library so slim that everything interesting is a implementation-detail. And, as I a said, javascript has less. Javascript even lacks integer variables, while scheme has the numeric tower. (Although that is not required by rsr4/rsr5 and that what most implementations care about)
- wtetzner 11y ago> No types, a very minimal syntax I don't see how these make the language less powerful. Especially the syntax part, which plays a big part in Scheme's power, as an enabler for macros. > a standard library so slim I agree with this though.
- deleted 11y ago[deleted]
- aikah 11y ago> I can't believe people still bash JavaScript. Can you believe you can satisfy every programmer out there with a single language? of course not. Why did you have to use all the languages you listed? Because some made sense in a specific context, other didn't. > Also, testing with JS is amazing - Especially unit testing on Node.js. It lets you do stuff like redefine entire objects, properties or methods at runtime (for stubbing). Also, JS is great for writing asynchronous logic. Testing with Python is also amazing. It doesn't matter how amazing it is if I hate writing Python code. No, the reality is that, in 5/10 years, javascript skills wont matter, only a good knowledge of the DOM and WebAPIs. In fact I'm pretty sure you'll see more opening for C++ developers on the front-end than Javascript ones.
- pcwalton 11y ago> In fact I'm pretty sure you'll see more opening for C++ developers on the front-end than Javascript ones. I would be happy to take a bet that this will not be the case. The fact is that JS is much easier to learn than C++, has a broader ecosystem in the browser, is faster to write than C++ due to memory safety among other considerations, and is fast enough for app logic. Think about it. C++ code has been supported for years on mobile. Yet Java/Dalvik is king on Android, and Objective-C is king on iOS. JS is faster than both (in the case of Objective-C, JS property access is faster than Obj-C virtual method dispatch due to ICs). So I see no reason why this will not be true on the Web as well. Web Assembly is very needed and important, but JS won't be going away.
- catnaroek 11y agoI have no idea what you mean by JavaScript being "easier" to learn than C++. My experience has been the exact opposite. C++ is a giant beast, but most of it was relatively easy to learn after I internalized the general principles that guide the language's design. These principles were the first coherent account I ever found of how programs manipulating ephemeral resources should be written. [I am aware that Rust improves on C++, but it builds on, rather than replace, the general principles established by C++.] On the other hand, in JavaScript I have never found anything even remotely close to methodological guidance for writing programs. JavaScript seems to make sense of anything as long as it is syntactically valid - a very low bar. As a result, I felt like I had to navigate a really huge space, hoping to eventually find a correct program somewhere. JavaScript's ability to run in the browser is, as far as I can tell, its only advantage over C++.
- sklogic 11y agoNow try to take a look at some real languages. At the languages with well-defined, simple, orthogonal semantics. And, no, JavaScript is nowhere near any "powerfull, expressive language". It is embarrasingly low level for a supposedly scripting language and it does not provide any powerful productivity features whatsoever. JS is also a nightmare for the implementers, it does not have a sane specification, therefore most of the tooling is not comprehensive.