3 ms·
> Use of the fn keyword makes it easy to find function definitions by grepping for it, whereas finding functions in regular C syntax needs semantic awareness.
by znpy 2y ago
> Use of the fn keyword makes it easy to find function definitions by grepping for it, whereas finding functions in regular C syntax needs semantic awareness.
does it matter though, in 2024 and beyond?
we've got clangd and lsp, grepping for functions is dumb, whether you're grepping C or grepping Zig.
- tmtvl 2y agoWe've had Ctags since 1992, so being able to grep for functions hasn't been important for 32 years... but there's still people who prefer to use grep to look for functions, so having a specific keyword is beneficial for them. It may also make the lex/parse/generate cycle simpler, but I'm not a compiler engineer, so I don't know for certain whether it does.
- znpy 2y agoWe had ctags for lack of better alternatives, not because it’s any good
- g-b-r 2y agolsp can be extremely slow, on constrained devices