logoalt Hacker News

Show HN: Tight C, a systems language with 10 keywords

25 pointsby alonsovm44today at 3:33 AM6 commentsview on HN

Comments

skulktoday at 4:48 AM

It's not clear what purpose this serves, as it just emits C code: https://github.com/alonsovm44/tc-lang/blob/9cb8af37cadc9221c.... Why someone would choose to write this and not C is therefore beyond me (there are fat pointer libraries for C)

In the pre-LLM days I'd congratulate OP on a clean implementation because this would clearly be a learning project, but now that I know that this doesn't represent much beyond a claude code prompt it just feels so hollow.

OP, if you're reading this, I'd love to hear you reflect on what you learned from working on this project and how (if at all) you plan to use this in the future (and if I'm completely off the mark about how this seems 100% AI generated). I'm not trying to take a jab or anything, just trying to center this discussion on human-produced outputs.

veltastoday at 4:48 AM

Very nice work for how small the source code is, and this is a relatively good design for the language.

I will say to criticise that I started scratching my head when I got to the standard library. The functions should really just be C's standard library. I know there's lots of baggage but e.g. remembering that 'print(s)' will print with a newline and 'printn(s)' won't, this is just putting a barrier to entry that's not necessary. Sure, have some new functions for slices, but if you can help it use more conventional names from C.

omoikanetoday at 4:47 AM

I think it should be "10 keywords" plus "11 types". In C standards, type names such as "void" would also be listed as keywords.

Also, the toplevel documentation seems to be missing examples for "pub" and "pin". Seems like "pub" is some kind of visibility attribute for structs, I have yet to figure out what "pin" does.

"defer" looks like a nice feature, although there is also a proposal N3852 to add that to the C standard (similar to `__attribute__((cleanup))` that already exists in GCC and Clang).

gblarggtoday at 4:45 AM

Does this lack something like typedef? I couldn't find anything in the docs which looked like one.

hyperhellotoday at 4:45 AM

I like the poetic smallness of it. But

i32 fn add: i32 a, i32 b { ret a + b }

Come on, can I just write C syntax, as an alternative?

i32 add(i32 a, i32 b) { return a + b }