Lurker News

Comments (286) 115 threads

Earlier comments
nojvek1 reply#
Typescript

Even though it’s a fairly complex transpiler, the authors did a good job modularizing and leaving lots of contextual comments on what each part does.
Also typescript baseline tests are a simple but very effective way to get lots of coverage on the compiler.
I’ve read source code for Babel, typescript, coffeescript and flow. Typescript architecture stands out.
Typescript not only does fascinating things like magical code completion abilities and great tooling for IDEs but their codebase has been an inspiration for me to build better front end code.
I may be a bit biased since I’ve worked at Microsoft before.

ioddly1 reply#
I found the TypeScript type checker pretty hard to read through, though it may be my lack of, well, almost any knowledge about type theory. I didn't dig much into the other parts of the codebase however. What parts of it do you enjoy reading?
nojvek#
While submitting a PR, the parser, Lexor and emitter were fairly easy to understand.
daniel-levin4 replies#
LLVM and associated projects such as clang. Bazel is good too. OkHttp and Retrofit by Square.
vnorilo1 reply#
LLVM is remarkable; the domain is both difficult and critical. Still, the code is consistent enough that I can often guess how things work based on what I think would be reasonable!
glandium#
Don't look how inline assembly is handled between clang and llvm.
tom_mellior1 reply#
I've been working with LLVM for a few years and I still find the code difficult to navigate and badly documented. And every single function's argument list is a random jumble of pointers and references (almost all arguments should be references, but many aren't).
anarazel#
Indeed. And it's not just medium to low-level stuff that's not well documented, it's the high-level stuff too. I personally don't mind that much if I have to spend a few minutes to understand something on a a very local scope, but if the bigger picture is unclear, that's quite bad. For LLVM one largely has to grep for a bunch of other users and try to figure it out from that.

While I think it has some clear deficiencies, I found a lot of e.g. the optimization passes in GCC a lot easier to read. It's probably above par, but e.g. https://github.com/gcc-mirror/gcc/blob/master/gcc/gimple-ssa... is really well explained imo.

McP#
The coding standard for variables in LLVM drives me nuts. Both class names and variables names must be upper camel case so if you're lucky the code looks like this:

Analyzer TheAnalyzer;
but more commonly:
Analyzer A;
with A being utterly unhelpful to read many lines later.

Load more comments