Godot is nice
Ask HN: What's the best source code you've read?
151–160 of 271 posts
Re: Ask HN: What's the best source code you've read?
#152I like the TypeScript compiler source (in TypeScript.) It's clean, easy on the eyes with well placed white space and just the right amount of comments. https://github.com/microsoft/TypeScript/blob/main/src/compil...
Re: Ask HN: What's the best source code you've read?
#153Earlier quoted context omitted.
Nix source code is also a pleasure to read through. I was surprised that c++ could be so beautiful and well written.
C++ gives you an enormous amount of rope to hang yourself with, but it’s also an highly expressive language.
Re: Ask HN: What's the best source code you've read?
#154Nobody has mentioned Knuth’s corpus of work in Pascal-Web for the TeX ecosystem. This is code written for an era where there wasn’t an ecosystem of libraries for common tasks and even things like being able to access a file in random access order couldn’t be counted on. Even 7-bit ASCII couldn’t be counted on as a given (EBCDIC-based IBM mainframes were a significant element of the computing landscape still). Against…
I second the nomination. I too have found the TeX Book to be very readable.
"The TeXbook" is the user manual for TeX. It is not the same thing as the book containing the (literate-program) source code for TeX, which is called "TeX: the program".
(Both are excellent, but in quite different ways, and someone looking for interesting code to read would likely be disappointed by the TeXbook, which doesn't contain that.)
Re: Ask HN: What's the best source code you've read?
#155Earlier quoted context omitted.
I have not read it in a while but it would be interesting to debate what essays are no longer relevant. I'll be grabbing it off the shelf next to my original copy of the Byte issue on C mentioned yesterday and having a look for expired relevancy.
There are some sections about physical copies of documentation and managing the logistics of that when I read it.
Re: Ask HN: What's the best source code you've read?
#156The kernel abstractions that allow for portability make the code quite easy to read. Back in the day, I was able to write a file system from scratch by just reading the code of other file systems. The build system is also pretty amazing (allowing you to cross build the whole OS for any hardware target from many other OSes) and not too hard to follow. The source tree is structured in a way that makes a lot of sense (IMHO better than FreeBSD).
Re: Ask HN: What's the best source code you've read?
#157Tanj Bennett created our original 8087 floating point emulator. It was real mode, 16-bit code, that kept an 80-bit float in five 16-bit CPU registers as a working value during its internal math calculations. If you ever coded for the PC you will appreciate just how precious register space was on the 8086/8088.
It's been a few decades and my memory is fuzzy but I don't recall any critical places where the registers had to be saved and restored. He choose math algorithms and code paths specifically to keep all five live at all times. Tanj's code flowed with an economy of motion that brought to mind the artistic performance of a professional dance troupe. I did not have the math skill and could not have ever created it as he had. It brought me genuine pleasure just to read his code.
Eventually, it came time to port it to 32-bits (real and protected modes.) I wrote new exception handlers and replaced the instruction-decode logic with a nice table-driven scheme but did not touch the core math library. It still ran in 16-bits under the hood exactly as Tanj designed it.
Tanj, if you happen to see this, I have fond memories of your emulator. It was beautiful.
Re: Ask HN: What's the best source code you've read?
#158The Racket implementation for protocol buffers. The generated code is just an S-Expified version of protobuf source files, all macros which generate actual protobuf implementation at runtime lol. I don't know why I was surprised. https://docs.racket-lang.org/generator/index.html Can't find source code online. I browsed the code in emacs with racket-xp-mode go to definition after installing it via raco pkg install. Co…
Re: Ask HN: What's the best source code you've read?
#159Earlier quoted context omitted.
It's not too bad, you just need to know TypeScript.. And not like "I know TypeScript." on a resume, I mean "I know TypeScript™."
For Angular, I think the “problem” lies in the level of abstraction. AngularJS was a “Spring / Java” answer to web applications with Angular following the paradigm but introducing reactivity to the system. Not “wrong” per-se, the quality of code is great and so I could recommend it at a tactical level of “good code” but at the strategic it feels off.
The problem with a reactive layout is that, if you're not going to just ask the user how they want to display things, you need to both read their mind and get it right 100% of the time.
Nobody can do that, so your web site shifts into mobile mode when I only give it half of my 3' display.
Re: Ask HN: What's the best source code you've read?
#160I've never seen C code as clear and well documented as tcl. E.g. https://github.com/tcltk/tcl/blob/main/generic/tclUtil.c , though more examples in that project are not hard to find.