Comment by Sohcahtoa82
7 days ago
tbh I think one of the things I really liked reading through examples was the change in the switch/case behavior. I always thought implicitly falling into the next case was an awful design, and that a break is the more logical implicit behavior except in the case (no pun intended) of stacked empty case statements.
I do all my coding in Python, but if I ever find myself needing to reach for C again, I'll certainly consider this.
EDIT: Though is there a reason why "fn" is needed? I would think the AST builder would still be able to identify the beginning of a function definition without it, and as a programmer, I can identify a function definition easily.
Things like that make grepping easier. And redundancy of syntax makes reading-without-mistake faster. The more you put on the page the lower the cognitive load, the more spare it has in it, the easier it is to search for increasingly refined contexts of use.
Agreed. It's tempting to make the tersest lang you can but in the end what matters is ease of reading.
For ex. parens-less calls (myfunc 42 "hello") are elegant but don't stand out and - for me - take more time to identify.
Also `fun foo(i:int)` is easier on the parser than C-style `void foo(int i)`
I prefer lack of "fun" and "fn", to me it is easier to parse C-style. :( This is one of the things (albeit minor) that put me off of C alternatives, I like to keep things as simple as possible, but I understand it has "macro" as well, so might as well have "fn", for the reasons already mentioned.
That said, I will still try C3.
10 replies →
I wrote a short blogpost about this before, trying to answer the question: https://c3.handmade.network/blog/p/8886-why_does_c3_use_%252...