←back to thread

Web Browser Engineering (2021)

(browser.engineering)
679 points MrVandemar | 6 comments | | HN request time: 0s | source | bottom
1. systems ◴[] No.41848736[source]
why python, why not a system programming language like C, OCaml or Go (or newer languages like zig or odin)

Are web browsers, not considered to be "system software"

replies(4): >>41848788 #>>41848806 #>>41848859 #>>41849811 #
2. nindalf ◴[] No.41848788[source]
Going to take a wild guess that maybe they're going to rely on the excellent, extensive standard library of Python which C and Zig can't compete with. The second constraint was probably that they want to keep the number of lines of code low to encourage more people to buy the book. That's where Python does better than Go - you can do a lot with list comprehensions and you don't have if err != nil every few lines.
replies(1): >>41849848 #
3. dvektor ◴[] No.41848806[source]
I think the point is to demonstrate how things work and are designed, and python is easy for everyone to understand. I don't think the author is recommending trying to write a production web browser in python. (or probably at all ;)
4. FartyMcFarter ◴[] No.41848859[source]
They definitely are system software, since they include compilers and interpreters, software libraries and other such things which AFAIK have always been considered system software.

Browsers these days are about as complex as any operating system, or perhaps more complex when you consider all the non-systems stuff in them.

5. pavpanchekha ◴[] No.41849811[source]
Author here, I wrote about this on the blog: https://browserbook.substack.com/p/why-python

Basically, performance isn't a big focus, Python is very widely known and doesn't have too many quirks for non programmers to deal with, and systems languages emphasize error handling that, for expedience, we often need to skip.

6. pavpanchekha ◴[] No.41849848[source]
Definitely the second reason, but we actually try hard not to use too much of the standard library, for easy porting. But it's nice that sockets & ssl are standard, plus a (bad) GUI library.