7 ms·
> The future of scripting languages is browser JavaScript. No. I'd wager it's much more likely _any scripting language but JavaScript_. Statistically speaking
by sam0x17 4y ago
> The future of scripting languages is browser JavaScript.
No. I'd wager it's much more likely _any scripting language but JavaScript_. Statistically speaking it's probably Python, though I wouldn't love that universe either, being a Rubyist.
Browser JavaScript has 30 years of technical debt in the form of the general inability to make non-backwards-compatible breaking changes lest half of web pages stop executing properly. This has been a boon for legacy code, but the language itself has languished for so long and in so many ways. It shouldn't be anyone's North Star, especially given a choice. Web Assembly gives us real choices, and I think it will eventually result in the end of JS's dominance in frontend when we all come to our senses and support improves a bit more.
- goldenkey 4y agoThe technical debt really only exists in some APIs. Many have been deprecated or replaced with newer ones, although the olden ones still exist. JS now has: async/await, lambda arrow functions, generators, optional chaining, null coalescing, spread and rest operators, destructuring of objects and arrays, block scope with const and let, default values for function parameters, for-of loops, iterable interface that works in any loop construct, template literals, dynamic object literal keys as {[foo]: 'bar'}, and many new APIs such as Symbol, Map, Set, WeakMap, Typed Arrays, Workers, BigInts natively as ####n, and so much more. Historically, the language has been progressive in having: first-class regular expressions as /.../, value-preserving non-boolean-coercing logical operators such as || and &&, closures, polymorphism of any flavor (even multiple inheritance) through prototypes, and so much more. The language is concise, beautiful, and the reason so many people like yourself have an ill perception of it, is because you wrote or worked with codebases that had shitty JS code that looked like PHP spaghetti. That isn't JS's fault. I've always written JS code into separate classes or modules. I've always found the language to be rather elegant and it's only gotten better in recent years in precision and conciseness. We now have better standard library objects and better DOM methods. The syntax and actual operators are so much more powerful. And lastly, it is fast as fuck for a JITted language.
- sam0x17 4y agoI agree that the new syntax approaches beauty, but there are places where it just so awkwardly dodges old skeletons, and there is no sense of stability. Imagine writing JS and having it look good and utilize best practices 5 years later without a complete syntactical overhaul. If you can't imagine that, there's something wrong with the community.
- MaxBarraclough 4y ago> And lastly, it is fast as fuck for a JITted language. Nitpick: it's fast for a dynamically typed language. It's not faster than, say, Java.
- easrng 4y agoHow do you do multiple inheritance with prototypes?
- goldenkey 4y agoThat's the point of prototypes -- they give you the power to do OOP in any way you want to do it. You manually write the procedures to do inheritance through prototype manipulation and generation. See https://www.crockford.com/javascript/inheritance.html https://www.crockford.com/javascript/inheritance.html
- dolmen 4y ago> Historically, the language has been progressive in having: first-class regular expressions as /.../, value-preserving non-boolean-coercing logical operators such as || and &&, closures, polymorphism of any flavor (even multiple inheritance) through prototypes, and so much more. Perl 5 had already all those features in 2000 (Perl 5.6), or even earlier.
- goldenkey 4y agoPerl was a great language while it lasted. I used it all the time in opsec.
- egeozcan 4y agoIt's very easy to ignore the cruft with JS, and opening up the console and typing some code and having a graphical playground makes it ideal to try things. Python and Ruby are not in the same category IMHO, and while they are extremely good at what they are designed to do, I doubt that they could reach the lingua franca status js has. I would evaluate JS with PHP, Bash and C together, and I know how weird that sounds.
- 411111111111111 4y agoThere is tooling for most script languages which enables the same and often much better experimentation playgrounds. JS having it in in the browser, which is basically guaranteed to be on all devices and doesn't have to be setup before use is it's true advantage
- Paddy3118 4y agoLingua franca "language used as a means of communication between populations speaking vernaculars that are not mutually intelligible." Javascript is too Web focused. Python and C are better candidates as they are more than Web.
- egeozcan 4y agoNearly everybody can read JS, significantly less people can read Python or Ruby, it's not even the same ballpark.
- jitl 4y agoA generalization like this doesn't convey much: > the language itself has languished for so long and in so many ways When I read this, I thought "I wonder what they're talking about?" and then came up with numerous counter-examples of things that have improved immeasurably since I started writing Javacript. For example, there is now a `class` keyword with truly private properties. When I started writing Javascript, you had to manually manage the prototype chain. But, I don't know what you're thinking of with that generalization. So it could be that there are many things that I don't notice anymore, but are still really crufty (like array reverse & sort mutating in place). Bringing those up specifically would improve the discussion.
- sam0x17 4y agoSpecifically, I would call the haphazard implementation of classes in JS one of these examples of a place where really true OOP should have been added, but they couldn't because they had to support existing keywords and web pages and language conventions, so we end up with the hacky syntax that is in the spec today. Another example is the mess with for each loops, with .forEach, and the for..in syntax, and the peculiar behaviors therein where nothing does what you think it would coming from any other programming language. Then you have things like "should I use var or let". It's embarrassing frankly. And don't even get me started with the uneven and confusing state of modules across the different ecosystems that exist now. For someone who has worked in js since the pre ES5 days, it's fine, because we know the history and we know "oh, forEach is a legacy thing, don't use that if you can avoid it" but to newcomers it is extremely overwhelming having this sea of available functions and syntaxes and not knowing what to use. I know because I have had to talk through this with hundreds of coding bootcamp students as I used to serve as a mentor for one of the major ones. I tell all of them that the JS of today is a spaghetti soup of 30 years of tech debt, because it's true. What's worse, is for newcomers, there is no way of viewing just the new/blessed syntax without going through each ES version and reading through the changes. It is very hard to distinguish the skeletons from the things you should use unless you know the entire history, and that fact is javascript's biggest smell to date. And it's also impossible to explain the new syntax in isolation without a story about what it replaced and why what it replaced fell out of favor. JS has been adding new language features at an alarming rate, doing so poorly, and the reason for this is they have to walk on eggshells so as not to break existing web pages. Multiply that by 30 years and you get the mess that is everything since the netscape days. Things really got off the rails with ES6+, though, in terms of adding "awesome" new stuff without fixing/reworking old stuff. It's just plastered on in time-sensitive, fragile layers.
- jollybean 4y agoPython is loaded with as much weirdness as JS. Python is not popular because of it's lack of technical debt etc..
- goodoldneon 4y agoBackwards compatibility !== languishing JS has added a ton of nice features while continuing support the skeletons in its closet. But you're free to ignore the vast majority of skeletons. You can block the old cruft using linters (e.g. preventing usage of `var`)
- karaterobot 4y agoMaybe in the far future, but in the near- and medium- term the same backwards compatibility that you believe (a little unfairly, I think) has hobbled Javascript will keep it dominant. If existing web applications can't be bothered to update to support ES6 or Typescript, what will make them rewrite in Web Assembly? New applications will, maybe, but it's a very, very slow change, with so many opportunities for new events to change the conclusion.
- mkss 4y agoReally? In 2022 you still think this, when people had the option to use any language they wanted to on the server side and yet Node's popularity is clear for even the most blinkered rubyist or pythonista to see... I've listened for decades while Python & Ruby advocates whined about how JS was terrible and should be replaced in the browser and yet when people had a choice on the serverside, they chose Node and proved you all wrong.