Hacker News new | past | comments | ask | show | jobs | submit login
Opossum: Cross-platform web browser written in Golang, optimized for Plan 9 (github.com/psilva261)
307 points by euclaise on Feb 20, 2023 | hide | past | favorite | 93 comments



At this point in market concentration, any sufficiently brave or delusional soul that ventures into even the most rudimentary web browser development is a hero to me !


I think what's been achieved in a little over a year with the Ladybird Browser from the SerenityOS project shows that it's quite possible to build a new browser from scratch. And yes, they are absolute heroes for doing it!

https://awesomekling.github.io/Ladybird-a-new-cross-platform...

https://linus.dev/posts/ladybird-browser-year-in-review-2022...


It's definitely impressive, and it shows it is possible to build a new browser. I don't think it shows it is possible to build a new browser that ordinary people will use though. That requires implementing a gazillion niche features that Chrome supports, and compatibility with a gazillion broken websites.

Probably with web browsers the last 0.1% is 99.9% of the work.


A lot of us would be happy to have a browser that doesn't try to support the gazillion features of chrome and Firefox, if it instead gave us the ability to browse the web on our own terms instead of one company's vision of what the web should be.


I share the sentiment. Reality is often physical businesses now require visiting their website, sometimes even in person, and they just don't work unless the browser is Chromium based.

Literally today I had to upload a drivers license in person yet on my phone to rent a truck. Of course Firefox failed, and even Chrome glitched, yet Chrome could be made to work with it's alternate uploader.


I've always associated advanced browser features with power users. Am I wrong?


The features they're referencing are JS apis and exact CSS behavior.

Web apps are >5MB piles of text, and they have a way of using pieces of browser behavior that you wouldn't expect.


Amen to that --- and those who do will quickly lament the state of the "Modern Web"; fuckings to CloudFlare and the like for gatekeeping and calling everyone who doesn't use even slightly non-mainstream browsers or configurations (no JS? Filtering proxy?) a bot. A disappointingly large percentage of sites are behind such walls, and another large number of them are otherwise static content that requires JS to display.

But not giving up is the first step to success. I probably wouldn't use a browser in Go either, but as someone who has also been working on one of my own intermittently and knows how much opposition there is, I certainly encourage any attempts at increasing actual browser diversity.


> At this point in market concentration

as others mentioned, some people don't care about market share. the browsers I use day to day (Firefox, Chrome) are honestly pretty bloated and terrible, so I think others would agree that quality wise, users are starving for something better.


Even though Go is unlikely to be an ideal choice for a web browser, I had definitely wanted to venture into it just as a toy project. Unfortunately, it's obviously an enormous project, so I am absolutely nowhere on it.

That said, shameless plug: if anyone wants a reasonably complete but immature ECMA262 parser in Go, I did do that. You can see how (un)finished it is here, with the wasm build: https://cleansheets.io/parser/ - source here. https://github.com/jchv/cleansheets

The truth is, I'd like to still work on this and even see if it's plausible to build a decent JIT without going too far into the weeds (I wouldn't tolerate a requirement on Cgo personally) but given that I never even pushed up an interpreter (I had an AST-based interpreter, but it was so ugly that I scrapped it :) I doubt I'll get anywhere near Opossum. Oh well.

It'd still be fun to at least get some pages rendering. Probably no chance in hell I'd ever get over to milestones I'd actually like to (like booting GMail for example.)


Beware of assumptions. You arrived at a funny conclusion here.

Did the author express that his intent was to capture browser marketshare? If not, he may not be delusional :)


I would say the browser ecosystem as a whole is thriving, there's all sorts of browsers for different needs, but most of them are based on the same couple web engines.

This looks like an implementation from scratch which is fantastic.


A modern web browser is comparable to an operating system in complexity.


Building a LLM from RFC, W3C specs and billions of websites to generate a web browser engine is no more scifi (but still has to be done)


Or the devil because if they succeed we'll need to check rendering on yet another target!


I fully acknowledge that Plan9 had a cool vision, maybe a superior one to the world we’ve got. But is it practical as an operating system for day to day use, particularly when working with other people using conventional Linux/Mac/Windows?


> But is it practical as an operating system for day to day use [...]?

It was never meant to be. Just like UNIX initially, it was a research operating system. UNIX turned out to be an accidental runaway success, and many of Plan9's greatest ideas (like synthetic filesystems, bind/union mounts, its threading library, the 9p protocol, etc) found their way to more "practical" systems.

It also did have a commercial counterpart in Inferno (mostly finding use in products like telephone switches). But nowadays both remain mostly as toys for enthusiasts. You can get work done, if you're patient enough, and have the freedom to ignore things like Zoom calls or Excel files.


>It also did have a commercial counterpart in Inferno

Plan 9 was also available commercially for some time.


With xls2txt(1) and the doc versions of the tool you can at least dump most of the text from the Office files

[1] https://man.9front.org/1/doc2txt


I have witnessed dozens of people making vague statements about how awestruck they are with plan9's vision, and I've always wondered what exactly they mean.


Maybe try https://9p.io/sys/doc/9.html

My take is that plan 9 is basically a "pure" rewrite of a unix/posix OS, that takes many underlying principles of unix to their logical conclusions, without the taint of the incremental evolution of the existing systems, yet nevertheless informed by the lessons learned operating real OS systems. The incompatibility is why it hasn't moved forward, though many of the good ideas that are compatible with systems like bsd/linux have since been ported over.

It is really useful exercise to consider, in hindsight, how could we have built a better unix? And a bunch of really smart people participated and came up with some great ideas.


It's difficult to encapsulate specifics because it's a large amount of small details in the design decisions that end up adding up to a lot. You don't need Docker, you don't need Nix, you don't need NFS or SSHFS or Samba. The world doesn't need web browsers to do as much as they already do. So much tooling is made totally redundant by the emergent properties of the system. A monumental amount of engineering cruft, tacked onto *nix by the necessity of outdated system design, is simply cut away. How? It's little things like namespaces not requiring a tasteless amount of systems bureaucracy boilerplate. The amount of power that can be leveraged by shell scripts rather than dozens of low level API calls in C is not to be scoffed at. It's more than this, so much more. But it's not something you're going to "get" by reading about it.


As with everything else, it depends on who you are and what you do. Email, typesetting, remote shells are all well within the bounds of what workflows work great out of the box.


Typesetting? the linux-centric FOSS world has failed to produce a serious type-setting application for going on 30 years now, what's the offering here?


Just troff and TeX


Johannes Gutenberg produced the primary, and, by far, the most serious, application for type setting 575 years ago, long before the era of the Linux desktop. It's called The Book. Read one some time, and maybe you'll learn what a comma is for.


Not when one cares about graphics programming.


It's trivial to get running in qemu if you're really curious.


Sure, but that doesn't seem to really be using Plan9, at least to me. Networked access seems so fundamental to Plan9 that running it in a sandbox seems like trying out a car with all the tires removed.

I'm interested in hearing what it's like to use it more seriously; my biggest doubts are around collaborating with people on conventional OSes.


I've used it as my "main driver" for around 6 months last year and I can assure you it's definitely practical, you can also easily interact with the other OSes with ssh and vnc, that way I could even do some remote video calls from plan9 with the help of another linux computer for instance.


Qemu allows full network access. It's a very porous "sandbox"


Maybe I misunderstood Plan9, but I figured that if remote services aren't speaking 9P then everything would be a bit kludgey. Like, using Acme on local files which you push up to Github seems to be somehow against the spirit of Plan9. I suppose you could just use it like any other Unix-like OS, but what's the point?

I think I'm convincing myself in this thread that it's not for me - but of course I think it's great that others are using it, I don't want to sound too negative.


I think it's more important that services can be exposed as filesystems like webfs or gitfs than that they are exposed as 9P.


There is an image for raspberry pi. I guess that can be a good way to force yourself into it. Just make sure to have vnc access to a linux, mac or windows computer if you need it for work too.


That question makes no sense really. It’s like asking whether camping can be as practical as living in a proper house - maybe for some people, but generally, that’s just not the point.


If that's the analogy, then I think the question is certainly answered for me! "Practical isn't the point" seems pretty similar to "no, it's not generally practical."


I think there’s an interesting clue in the fact that the entire 9front has less lines of code than Go, which this browser depends on. And that includes two web browsers already shipped with the system! Yes, there are ways to force Plan 9 into something it isn’t, but fundamentally starting from the assumption that you want it replace your daily driver is not going to work out.

If you’re interested in it, set it up on a Raspberry Pi, connect to it with drawterm from your daily driver. Experiment with adding a second machine, netbooting it as a CPU server etc. That way you’ll look at Plan 9 from the point of its strengths, not weaknesses.


Thanks, this is a good suggestion, and it sounds a lot more like what I'm looking for - "seeing Plan9 from its strengths" is exactly right.


Nice! I'm glad to see more people are interested in creating browser from scratch. Tho like the "OS from scratch" trend, most of those browsers won't be as nearly as performant or complete as those market-leading browsers without ton of work put into it. Making a browser is not a one man job.

But it's certainly fun to make a browser! I happen to keep track of the open-source browser projects & resources here if anyone is interested:

https://github.com/ZeroX-DG/awesome-browser


Huh, interesting that you implemented flow (block/inline) layout but not Flexbox or CSS Grid. I've been working on a library has the opposite! (it support Flexbox and CSS Grid, but not flow layout). Here if you're interested:

https://github.com/DioxusLabs/taffy

I'll definitely take a look at your browser when I get some time.


Woah, that's so cool. Maybe I'll use your library for flexbox support in my browser!

I implemented the flow layout first mainly because I didn't know how difficult it would be to support flexbox. The flow layout just seems like an easy entry point back then.


If you don't care about JS and just want a good hypertext document viewer with decent HTML and CSS support, I think it shouldn't be too hard to beat mainstream browsers on performance.


yeah that's true. A hypertext document viewer with decent HTML & CSS support is basically a stripped-off browser so it will almost always have a better performance.


Wow, I didn't realize so many people were interested in this. I've been wanting to make a hobby browser for a couple of years now but haven't gotten past some basic steps, but seeing this really does make me want to go deeper. If only I had more time.

At least I will enjoy checking out other projects in the meantime.


Yeah I think you should definitely go for it. I was hesitated for a long time as well but decided to just throw myself into it & use it as a learning experience. After about two years, I got myself a very basic browser & ton of useful knowledge about browsers & their quirks.

It wasn't an easy journey but I really enjoy it.


you should add dillo


Oh nice, and it’s an actual browser engine not just another chromium wrapper \o/

Good luck to them - we need more actual engines rather than the modern “new browser” model where it’s just whatever Google want in chrome.


http client, UI interactions logic, domain models, utilities like tree operations, browser domain logic

and all of that inside single go file?

I think you'd make your life 10 times easier by splitting it better


What difference does that really make? In Go, all files in a directory share a namespace. I think the only impacts of splitting a file are build tags and shortening the import list, and neither really applies here.

Those components you listed could be in separate packages, but in a program this small that seems merely different, not better or worse.


>What difference does that really make?

Depends if you want to continue developing this (or any) project

If you want, then it makes huge difference, the faster you refactor it, then the easier the development will be.

If you want to stop putting effort into it, then there'll be no difference.

One file doing everything is almost always more annoying than stuff splitted correctly.


Not just for continuing development in general, but it would be nice for potential contributors too!


> all of that inside single go file?

no, did you even visit the link?


what's inside "browser.go" then?


did you not see the 20 other go files in that repo?


I've seen, but the point is still valid.


Did you even look at the repo? There are many files.


Answered that in other comment

I've seen them and point is still valid.


Curious to see how they will get WebGL and WebGPU over file handles.


Does Plan9 even have hardware OpenGL implementations to begin with?


No, and having a file based driver for graphics also doesn't help that much.

https://marc.info/?l=9fans&m=111558695515839&w=2


Why do you believe it is impossible to display a web page of text on screen without a 3D graphics accelerator adapter card? Haven't you ever used a computer without a Nvidia in it before? A young kid like you might be surprised to learn that there was a time not so long ago when most computers didn't have 3D accelerator cards, and that they were still more than capable of rendering a page of information and driving their displays.


Sure it is possible to display the page with text, it is matter of what compatibility level one wants to achieve in regards to modern Web platform in pages that might have 3D and media content into them, which includes some forms of CSS styles as well.

Ultimately everything can be done via software rendering as well, depending on how much one is willing to wait.


OpenGL already has a client/server model (i remember a friend of mine once showing me running some OpenGL stuff from his SGI to his Linux machine... or the other way around, it has been years :-P) and i can't think of anything in WebGL that couldn't work in the same way (though i only used WebGL very little). Sending commands and data over a file handle fits this fine.

Note sure about WebGPU though.


Yes it did, if the only thing one cares about is OpenGL 1.x like performance.

X Windows did not come up with shared memory communication and hardware mapping extensions just for fun.


You aren't going to be sending vertices through the pipe every frame.

You are going to be sending commands to create the vertex buffers and upload textures (with the relevant data) and then most of your commands will be referencing those. Which is basically exactly what discrete GPUs already do anyway.

IIRC, unlike OpenGL, WebGL doesn't even allow you to do things in another way.

What X Windows did isn't very relevant because the use is very different. It'd only be somewhat comparable if the WebGL programs would treat WebGL as a way to stream new frame data for every frame (e.g. video). Also all X Windows communication with clients is done via commands sent through unix sockets which have similar performance to pipes.


GPUs and game consoles use DMA with command buffers for transfers, and synchronization points, not file handles with IO APIs.


Right but WebGL and OpenGL without vendor-specific extensions does not expose those so they are irrelevant here.


Congrats Philip on hitting #1 on Hacker News! Great piece of work!


Serious question: What is Plan 9? Can someone explain or send me some docs to read? Thank you!


Bell Labs' planned successor to Unix: https://en.m.wikipedia.org/wiki/Plan_9_from_Bell_Labs


Thank you I will do some reading!


Someone already answered, but as some follow up reading I recommend this collection of documents: http://doc.cat-v.org/plan_9/


Thank you! I'm going to read up.


Serious question: is anyone here using Plan 9 for daily operation?


Posted from 9front (using netsurf).

I also run https://shithub.us, which is hosted from plan 9, and more or less needs plan 9 for push access. It uses the hjgit:// protocol for push access, which requires plan9 auth to establish the channel. The fact that there are so many repos up should give a hint at how active the community is.


Follow up question then: why?

This isn’t meant to come off as judgmental, but a real question. Plan 9 looks pretty neat but I would think that the lack of driver support alone would make it pretty difficult to run for anything.


The term is 'recreational computing' ;)

But actually most older thinkpads are pretty well supported, you can even get Wifi with OpenBSDs drivers.


It's comfortable. And it works with the hardware I own just fine.


Fair enough! I've played a bit with Inferno and Plan 9 inside VMs, but never tried to run it full time. Maybe I should give it a go on one of my spare laptops.


Has anyone built this? I'd love some screenshots of my website.


https://i.imgur.com/GPdnYBa.png

Building on mac was easy. It compiled fine with just go. But then to run it I needed:

git clone --depth=1 https://github.com/9fans/plan9port.git cd plan9port ./INSTALL


ROBLOX


[flagged]


What's the problem with GC? Between C and Go (and maybe Scheme) there's not much choice of languages on plan 9 today.

So not having to think about memory management in a browser pet project is surely the best choice when it comes to a relatively ambitious project as this.

Also of note, Limbo (the language the successor was written is) is also garbage collected, so it's not like it's against the spirit of plan 9. The predecessor language, Alef, supposedly was abandoned in part because it didn't have GC.


There's also Myrddin, Ocaml (port), and Haskell (nhc and Hugs), and there was some work on getting Zig working on Plan 9


Lua works pretty nicely also.


If we're including languages that have no intention of being compiled, there's also TCL and Python 2


Don't forget Perl


Indeed, we need more such projects to clean our industry from non believers.

Alef for Plan 9 was going to be GC based, and even though it went in another way, Inferno and Limbo clearly fix that error.


Go itself is pretty much Alef 2.0


It could have kept dynamic loading and pick types from Limbo, though.


https://pkg.go.dev/plugin but not for all platforms.


It is not the same.

Not only it doesn't work in all platforms, they already planned to drop it once, and uses low level dlopen like API.


I wonder how much ad-hoc GC popular browsers have and what the tradeoffs are in comparison to using a runtime with a GC and avoiding allocations where necessary.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: