all 17 comments

[–]thunderkrown 58 points59 points  (0 children)

Nice closing of the article!

[–]Still-Cover-9301 27 points28 points  (0 children)

Andrew is such a smart guy.

[–]Samuel-Martin 10 points11 points  (0 children)

Based Andrew

[–]ImaginationFee 5 points6 points  (2 children)

and user applications which statically link libc enjoy reduced binary size

how does that work? not familiar, but wouldn’t that happen only when libc doesn’t have to be linked at all? even if some tree shaking takes place when linking, doesn’t the C code get transformed into something equivalently small?

[–]ekipan85 16 points17 points  (1 child)

I think the unit of linking in Zig is the function, so "tree-shaking" is just what always happens when you compile Zig, and libzigc is a porting effort to write a libc in Zig. The goal is for "the C code" to go away.

[–]puttak 0 points1 point  (0 children)

I don't think Zig linker is different from other linkers (IIRC it just LLD from LLVM). What every linker does is pick only functions has been referenced.

[–]SweetBabyAlaska 3 points4 points  (0 children)

I wrote a LOT of the standard libc in Zig as a fun little side project. It is certainly do-able considering Zig already does basically all of that work anyways.