Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

To be honest, I wouldn't exactly call this "beautiful"...

https://source.netsurf-browser.org/libdom.git/tree/src/core/...

https://source.netsurf-browser.org/libdom.git/tree/src/core/...

https://source.netsurf-browser.org/libcss.git/tree/src/parse...

Looks like the authors have a severe case of goto-phobia that causes a quadratic explosion of copy-pasted code in the error-return paths. Some of the files also feel like they have been translated into C from C++ or some other OO language by some automated tool, resulting in some very long "namespaced"-looking identifiers.

Then again, I don't think Firefox or WebKit code is that much better either, so my impression of this codebase is neither great nor horrible. As "beautiful" is subjective, to give a reference for what I'd consider beautiful, look at BSD or early UNIX.



I agree with the above sentiment regarding the 'gotophobia'. Still, at a glance it looks like a codebase where lots of care and diligence has been taken in documentation and code presentation.


I also find the code to be clear and easy to read. Looking at the samples you provided, I feel like I could step right in and work on this project with minimal cognitive load. I actually like the style.


there are other "C++ programmer trying to write C" anti-patterns, such as typedefed structs and one "class" per file, leading to terrible performance without LTO. stuff like https://source.netsurf-browser.org/libdom.git/tree/src/core/... has more signs of excessive C++ love: "vtable", "protected", etc. I don't know that these things are inherently bad, but they certainly don't exist in C.


...and despite that, it still manages to feel faster than the mainstream browsers, which says just how much extra overhead those have, and that there is still "more room at the bottom" to trim this one down some more too.


That first one is madness! That's not even goto-phobia, that's just not knowing what arrays and loops are.

The third one is true goto-phobia of course. Crazy how people can't see the mess they make by avoiding goto for the sake of avoiding goto.




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

Search: