Nobody 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…
Ask HN: What's the best source code you've read?
211–220 of 271 posts
Re: Ask HN: What's the best source code you've read?
#212Earlier quoted context omitted.
Using Unicode symbols wisely in mathematical code is a godsend. I regularly use Julia, which favors this style, and find that this feature improves the readability of code enormously.
How do you then type these characters? google, copy, paste? Or is there a better workflow?
Your OS keyboard layout, at least on Linux, can be customized to include any characters you type frequently. I haven’t gone very deep down this rabbit–hole, but I have turned on some options that make nice quotation marks (“‘«»’”), em–dashes (“–”), ellipses (“…”) and a number of other characters (“²³½⅓¼≠±÷∞×” and so on) readily available with a compose key. I also put arrows on the numberpad, of course (“↙↓↘←↔→↖↑↗⇙⇓⇘⇐⇔⇒⇖⇑⇗”). Very useful for talking about menu items, like File → Save As (it has actually startled people when I can type things like that fluently in conversation).
My editor of choice is Emacs, which has a built–in way to select characters by name. Typing `C-x 8 ` prompts for a character name, with fuzzy searching and autocompletion. It also recently gained a similar facility for Emoji, which is more focused around the visual appearance. `C-x 8 e e` opens it. `C-x 8 e s` lets you search by name.
Between your keyboard layout and your editor’s search capabilities and custom keybindings you can do anything.
Re: Ask HN: What's the best source code you've read?
#213Re: Ask HN: What's the best source code you've read?
#214[0] https://github.com/postgres/postgres/blob/master/src/backend...
Re: Ask HN: What's the best source code you've read?
#215Re: Ask HN: What's the best source code you've read?
#216I will always have a soft spot in my heart for Django, the python web framework, even though I don’t use it anymore. https://www.djangoproject.com/ When I was still learning to code, I spent hours and hours and hours poking around the Django source code. In particular I was fascinated by the metaprogramming used in the Model and Query objects, and I ended up learning a ton about how Python works under the hood.
Me but with Flask and its cohorts like Werkzeug. I always found the amount of security advisories with Django vs that to be something alarming. I might still use it once in a while for something like prototyping. Python is easy to write but writing it "right", in a way that doesn't compromise performance, is a thing.
Re: Ask HN: What's the best source code you've read?
#217Earlier quoted context omitted.
What about this https://observablehq.com/@tomlarkworthy/redis-backend-1
The same thing. I don’t see chunk reuse, nor the ability to generate standalone documentation or export the code to files. Have you seen actual literate programming documents? The Noweb tool’s page has examples.
Your stuck on Knuth's definition of literate programming but this is better than that
Re: Ask HN: What's the best source code you've read?
#218I haven’t read all of it, but the Principia source code has a comprehensive units system and makes effective use of Unicode: https://github.com/mockingbirdnest/Principia/ https://github.com/mockingbirdnest/Principia/blob/master/ast... is a decent example of both: // We compute the mean rate (slope) of the mean anomaly M(t), the mean // argument of latitude u(t), and the longitude of the ascending node Ω(t). … Product…
lovely. it's 2022 and I see unknown-glyph-boxes on my up to date smartphone... I love the use of mathematical glyphs in math code, too, much more readable, _if_ it's readable. sigh.
Re: Ask HN: What's the best source code you've read?
#219OpenBSD source code[1], because I think it represents good design. The code is as little as possible and easily understandable. [1] https://cvsweb.openbsd.org