Changing languages is not a magic bullet. Browsers written in C++ can be just as safe and maintainable -- especially with the resources of large companies behind them, with tons of engineers and testers etc.
In 2013 I don't think it has anything to do with the merits of C++ vs other languages. You can surely write a better browser from scratch in a language like Haskell; a project this important could even implement their own JVM if they want to use Scala and need to guarantee some performance characteristics. Like how Facebook wrote their own PHP compiler/optimizer.
A browser that breaks on non-standard markup is worse than useless. Legacy compat is so critical and so complex that a rewrite is just not an option. Lots of money and time is invested in battle-tested security etc, you can't just throw that investment away. Again, like how Facebook is still written in PHP.
I agree with you about the project being a joy for the developers.
But as a user, in no way I would rely on a browser started in 2020 written in c++ (or in zig, given other comments about its security characteristics). Keep in mind that gecko/webkit were written initially in c++ because c++ was the best language available at the time for these projects. This is not true anymore.
This is true, but consider that today we are using computers fo to run tasks much more complex than 30 years ago. Rendering a complex HTML page with CSS and Javascript is an herculean and time-consuming task, which is why Firefox and Chrome are written in C++; and don't forget deep learning!
Plus, low-level languages like C are sometimes the only way to go if you are writing for embedded systems with slow CPUs.
Not everybody wants “Scheme in the browser”. In the spirit of “Worse is Better”, plenty of people want to run C++ in the browser. I’m not one of them, but hey, whatever floats your boat.
That said, I’d like a few useful libraries (e.g. - fixed precision decimal arithmetic) written in web assembler. But otherwise, I actually prefer writing in JavaScript (as FP more than OOP) over C++/Java/C# (degenerate Simula 67 clones) for most application level tasks.
Writing in C++ won’t make DOM access or async I/O go away, though :-)
Off the top of my head, any of these would have been a much more sane choice: Standard ML, Ada, Java, concatenative languages, E, Lisp, Haskell, Erlang, Python.
> few people (including me) would accept a "security upgrade" which made my browser significantly slower and memory hungry.
I can't tell if this is a joke. You know practically website is constantly running the shittiest JS you can imagine (and sometimes Actionscript), right?
Even if the language somehow can't handle implementing a certain task efficiently, you could still make a separate OS process for say, decoding the video stream, and passing it back to the safe code.
If you think there is a technical reason that browsers/OS today are written in C/C++ you are wrong. The reasons are purely circumstantial. Also note that most C/C++ coders aren't aware that other languages even exist or are practical, so good luck getting them to switch.
People who don't know say these things. Try writing web applications in C/C++, it's a deluxe development situation. Where do you think web browsers come from? Everyone afraid of C/C++ are shooting themselves in the feet.
reply