by knightofmars · 11y ago · 0 comments
The resources available to an individual for creating and reasoning are finite, and as long as one is able to give good reasons why they know that there is a better way, "there is a problem" may still be valuable information.
Right now, the world only has 3.5 base browser engines. Those browser developers have no interest in adding a new standard language like Python, even though more people prefer that to Javascript.
So, if you were to develop a new browser language, you need to build a new browser from scratch, and then move a billion people to it.
Just let me know when browser vendors are going to break down the two-tiered system, and let us run the legion of alternatives alongside -- instead of under -- JavaScript.
Or, they could take their own medicine, and try and write the browser in JS.
The complexity of doing that would be needlessly high compared to just improving JavaScript. Having to integrate a C++ DOM with a JS DOM is hard enough. Think about how you handle cross-language cycles…
> Or, they could take their own medicine, and try and write the browser in JS.
You mean like Firefox?
This is a very strange comment, especially coming from you.
Everybody knows that the bulk of Firefox is not written in JS. You personally have spent years of your life working on a new programming language precisely because JS is not suitable for writing a web browser.
I'll take your position on JS seriously when you abandon Rust and begin writing the bulk of Firefox in JS.
"You should abandon Rust and write in JS" presupposes exactly the kind of strawman I've been arguing against. You don't have to abandon your favorite language!
In browsers, the OSes of the web, nope, just a bad language designed in 10 days that resists all attempts to make it not bad.
It doesn't really matter if you like javascript, there's so many people who don't.
Why do you get to dictate whether we can or can't develop on the web? You leave us with a horrible choice, use what we consider to be one of the worst modern languages, or not develop. Why do you get to make our professional lives miserable?
The kernel doesn't have a DOM. On the Web, the number of GC'd objects that every "process" has to deal with exceeds the number of file descriptors by an order of magnitude.
Also, you do have a choice: you can compile your favorite language to JS, even low-level ones via asm.js.
> Why do you get to dictate whether we can or can't develop on the web? You leave us with a horrible choice, use what we consider to be one of the worst modern languages, or not develop. Why do you get to make our professional lives miserable?
That's not the choice: you can compile your favorite language to JavaScript. That's what source maps, asm.js, and the like are for. And JS is being improved all the time; it's not static.
Trying to add another language has been tried multiple times and has always failed, because having two languages that both interact with the DOM is much more difficult than just improving JS.
Servers and command-line tools are an exception because your interaction with the host platform is limited to a few dozen syscalls that can be easily bound to a number of different languages. Not so with most GUI software.
This is unnecessarily inflammatory. I've been writing JavaScript since back when it was called LiveScript and while it's certainly not my vision of the perfect programming language, it's come a long way. The code I write now is considerably cleaner, easier and more reliable than the code I was writing in 2005, much less 1995.
No, it doesn't work on OSes. OSes only handle one language: the native machine code of that platform. Everything else must be compiled to it.
This is exactly the same as browsers.
Edit: At least two people disagree with me (-1 points) - would you mind elaborating why?
It's only a matter of time before other languages can have the same level of support.
However, cries of foul "vendor lockin" erupted. So I dunno what to tell you, man.
> asm.js doesn't support threading.
asm.js supports threading, actually, through Web Workers and SharedArrayBuffer.
> it can't run native code.
This is true, but asm.js is relatively close to the metal. It's not very far from assembly language.
> it doesn't support meaningful debugging.
This is a tooling issue. While the situation is bad at the moment, it'll surely improve.
> it doesn't have a post-DOM API surface like pepper.
Why do you need a "post-DOM API surface"? If you just want to blit stuff to the screen, the DOM is actually no less efficient than Pepper: you can directly pass it pixel buffers, or call OpenGL routines.
None of these problems would be difficult to address if the four-member vendor cartel which controls web "standards" was willing to adopt NaCl. Of course they don't want to adopt it, but that is the real problem right there. Of the four, two members (at least—maybe now three) have an active interest in holding back the Web to protect their native app platforms, while one would rather reign in Hell (through its position of shared mastery over the Web hairball) than go broke in Heaven. As to support for other languages, I only have to point out that one of Mozilla's reasons for decrying Google's intended browser support for Dart was that Dart compiled to JS would not be competitive with the native Dart implementation.
Just let me know when Intel, AMD and VIA are going to break down the two-tiered system, and let us run the legion of alternatives alongside -- instead of under -- x86 assembly language.
> What does that even mean? It's nonsensical.
What it means is that the situation with browsers is not much different from the situation on native platforms. CPUs support one language, the browser supports one language. And yet I don't see anyone complain about CPUs only supporting one language, because you can compile anything to it. The same is true for JS, so why do people complain?
>Underneath x86 assembly language is the processor microcode, and underneath that is the actual hardware, and the two are intricately intertwined.
Underneath JavaScript is native code produced by a JIT compiler. It's not super-intricately intertwined with the underlying OS and hardware, but it's not incredibly abstract either.
>You can replace the hardware; C compiles, for example, to everything from ARM to x86 to Atmel's AVR harvard architecture.
>You can replace the language; everything from C to Swift to Rust can target almost any processor architecture, without externally enforced limitations.
You can also retarget stuff compiling to JS to compile to something else, like Lua.
>Microsoft can ship the CLR for ARM, x86, PowerPC.
> You can't replace JavaScript. Everything must pass through a JS JIT, and the JS JIT is written using functionality that 1) it requires, and 2) is totally unavailable to you.
Yes, everything must pass through a JS JIT... you don't have access to the underlying native code. But everything on a CPU must pass through its microcode translator. That uses functionality it requires which is unavailable to you.
> Microsoft can't ship a fully functioning CLR for JS.
This simply isn't true. You can write a CLR for JS that compiles to something like asm.js at runtime. Bytecode VMs with JIT compilation have been written in JS before, see Emterpreter for instance.
Because we don't write assembly ourselves. Unless we are doing micro optimizations, we don't even have to look at it. We do however, have to look at your shitty JS.
JS is not the "assembly of the web". It's a high level language. Your comparison is idiotic.
Like Blink-in-JavaScript[0] ? ;)
That's a legitimate complaint.
There's so much inertia that without the backing of the major browser manufacturers, any effort to introduce a change is doomed to obscurity.
People are allowed to complain, even while not being able or willing to work on a solution. We used to do that with DOS all the time.
I like Javascript, in many ways it's a neat little language, but manipulating the small little ad-hoc data structures (arrays and hashes, and combinations of them) that seems to be half of most programming tasks is definitely a step backwards compared to Python.
I'm a Python fan but I can't disagree more on that point. Python has terrible lambdas, and poor idioms when working with collections (list iteration over chainable/fluid interfaces).
Underscore.js, which at this point stands for 'idiomatic JS for collections', and the ES5 methods on arrays (filter/map) which are largely supported now provide a better way to handle arrays & hashes than idiomatic Python. With ES6 fat-arrow functions it's even better.
It's one of Python's biggest weaknesses when compared to other dynamic languages IMO -- that the idiomatic way to deal with 'collections' is not a chainable/fluid pattern, but instead to do multiple list comprehensions, or use the ugly filter-plus-lambda patterns which compose badly.
Double evens in a list:
ES6:
[1, 2, 3]
.filter(x => x % 2 == 0)
.map(x => x * 2)
ES5: [1, 2, 3]
.filter(function(x) { return x % 2 == 0 })
.map(function(x) { return x * 2 })
Python: map(lambda x: x * 2,
filter(lambda x: x % 2 == 0, [1, 2, 3]))
# or
evens = [x for x in [1, 2, 3] if x % 2 == 0]
[x*2 for x in evens]
The ES6 & ES5 JS examples are both clearly superior syntax IMO. More readable and the anonymous functions support multi-line so extend to more use-cases.EDIT: Removed the word 'objective' because I'm talking syntax.
map(lambda x: x * 2,
filter(lambda x: x % 2 == 0, [1, 2, 3]))
But the list comprehension version is just completely wrong: [x*2 for x in [1, 2, 3] if x % 2 == 0]
Which, in our subjective world, is cleaner than the ES5 version and almost as clean as the ES6 version.I was not trying to illustrate that the backslash made it ugly (I've removed it - I was pasting from a repl). It's ugly because of Python's lambda syntax and the fact it does not compose 'sensibly', as compared to fluid interfaces. The logic is back-to-front for one.
> But the list comprehension version is just completely wrong:
No, it's not at all wrong. Your one-liner is not better and (I hope) would probably upset most teams for being less clear.
I was providing a like-for-like example. The multi-lining is not the criticism of the Python version. It's the composition that's at fault, the fact it does not feel like 'two coherent operations over a list' with two distinct conditionals.
The ES5/ES6 examples demonstrate this much more clearly IMO.
This sentence reveals a deep misunderstand of either what "objectively" means.
(FWIW, I prefer the ES5/ES6 syntax to Python here, as well; I just don't mistake that preference for something other than subjective.)
It's easy to pedantically point out I used 'opinion' in the same sentence as 'objective' but I'd hope you could apply 'the context of programming' to gather what I actually meant.
When we say 'objective' over matters of syntax I tend to think of 'If you put N programmers in a room they'd all agree this was better syntax'. That's how I feel about the above examples I posted.
That said I've edited my comment so I don't inflame other commenters to point out my glaring contradiction :)
'The depths to which JavaScript sucks are well-documented and well-understood.'
Same applies to Haskell. As with any language, humility please.
This would require people like Eich to entertain alternatives to his diseased progeny.
-Bob Burns
If one believes that "JS is the worst thing to happen to the web" and that "some other language would miraculously solve all of the problems" then going off into the wilderness to "create" is almost certainly a dead-end endeavour. A language is only one component of what's needed to replace JS - there's also winning over 4 major browser vendors who've dumped no trivial quantities of money, time, and PhDs into polishing this particular turd.[0] Then there's the standardisation peeps and so on. It's not so much a technical challenge - many existing languages could add support for DOM APIs and become an in-browser candidate relatively trivially - but a political one. And when was the last time you heard of someone solving a political problem by saying "hey guys, I've got a great idea here"?
Some not-absurd propositions:
1. "The finance system is shit"
2. "Modern government is shit"
3. "JS is shit"
All 3 of these have many potential non-shit replacements - but things never change. Why? Because barriers are very, very real. These things could only ever fall to the most expertly executed, well resourced, and lucky of targeted attacks.The only viable strategy for the average "hater" (whose "hate", incidentally, is emphatically not invalidated by his lack of perfect solution) is to try to affect top-down change. Now, no one person is likely to achieve this - even exceptional people have a fearsome challenge when faced with groupthink (Galileo, anyone?)
So what is in the "haters" toolbox? Well, seeing as web standards authorities are run like district councils in the 1980's (go try to find out how to make your view officially known on an ECMAScript draft), us in the peasantry have little but our ability to create and maintain a murmur - and occasional scream - of discontent which hopefully, one day, might have some psychological effect on those who do hold the power, because lord knows it's not us users. You may recognise this particular strategy from historical great hits such as "representative" "democracy" and friends where it has been, on the whole, a slow, inefficient, wasteful, but occasionally effective way of going about things.
So my well thought-out and actionable strategy is to ignore this advice and continue to grumble - and, if you can manage it, try to be just a little bit louder than last time: shit adds up at scale.
[0]: Mr Eich told me himself that they're too invested in JS, see https://news.ycombinator.com/item?id=9264531"...but things never change." I think you're wrong. Things do change. They just don't change at a pace that is fast enough and obvious enough for someone who feels passionate about an issue (Gay rights, Women's rights, Black's rights, all civil rights crusades, anyone?) And it often takes a long time for people to realize they need to be actively engaged instead of complaining from the sidelines before any change occurs.
By all means, continue to grumble on comment boards, just don't act surprised or upset when the direction of the thing you were grumbling about doesn't go the way you want it to.
I don't want a web where all my software and data is owned by other people who don't have my best interests in mind. JavaScript allows "free" websites to replace programs running on my machine which is fundamentally opposed to my goals. I don't want all the power that computers have brought to humanity to be concentrated in the hands of corporations, I want it to be free for anyone to use. I'm glad JavaScript is shitty and I wish it were shittier, because that would slow the growth of corporate control over our capabilities and data.
Conversely, I can write open-source javascript that does something useful for you, that does not mine your data or do anything of that sort.
I don't see how this relates to javascript.
I would venture that I could solve all the problems you would solve with open source JavaScript with another programming language, because almost no program actually needs to be a web application.