5 ms·
JS isn‘t a general purpose language, even though is has been shoehorned to be one.
by Hendrikto 5y ago
JS isn‘t a general purpose language, even though is has been shoehorned to be one.
- quickthrower2 5y agoYes I mean JS with node
- JrProgrammer 5y agoI would say it is. It didn't start as one but over the decades it sure has become a general purpose language. I can't find a domain where JS wouldn't fit the description. While it may be a bad fit for certain problems, it can still be done.
- dgfitz 5y agoSafety-critical controller for manned or unmanned aircraft, ground vehicles, etc. High frequency trading. Tiny embedded devices. System libraries. I’m sure I could come up with more. JavaScript is a tool, just like c, go, rust, python, lisps, etc. I’m going to give you the benefit of the doubt and hope you just didn’t consider all of these other domains when you made this comment. Cheers!
- JrProgrammer 5y agoThe domains you listed are not really disproving my point. I'm certain that programs could be made in JavaScript for these domains but, like I said in my first comment, it's probably a bad fit. For example: Espruino is a platform for embedded JavaScript. I just think about it this way: Just because you wouldn't doesn't mean you couldn't
- runarberg 5y agoYou might be confusing the JavaScript programming language and the browser runtime. The former is a general purpose programing language that favors prototypical object oriented programing paradigm but supports multiple other paradigms such as imperative and functional. The latter uses the JavaScript language and adds on a bunch of specific APIs (such as the DOM) for specific purposes. This includes APIs for DOM manipulation, playing audio, validating inputs, parsing forms, handling key presses, etc.
- wongarsu 5y agoJS is incredibly versatile, though I would agree that that's mostly JavaScript being equally bad in nearly every domain :) I wonder how much of the horizontal scaling trend is driven by JavaScript's horrible threading story.
- ravenstine 5y agoWhat does that even mean? I've pretty much gotten away with using JS for just about everything for the last 4 years. The evolution of a language to make it compete with other languages isn't necessarily "shoehorning". Am I not a true developer because I like JS and haven't found a need to write code in something like Rust? EDIT: Do you mean that it lacks certain features without a runtime like Node or the browser? For instance, it doesn't have a language construct for opening files like Python or Ruby. If so, I don't think that's a good argument.
- freedomben 5y agoI'd be curious to hear some examples where JS doesn't fit as a general purpose language. In my arrogance I suspect it would be hard to give examples that don't also disqualify other scripting langs like python and ruby. Perhaps you don't consider those to be general purpose either?
- Hendrikto 5y agoFor example, without something like Node, you cannot even open a file. I consider this a very basic requirement for being "general purpose".
- freedomben 5y agoit sounds to me like you're talking about a particular implementation (the browser) not the language itself. The browser intentionally has that limitation. The language itself has no problem with it.