This commit is contained in:
Miloslav Ciz 2022-06-06 21:13:46 +02:00
parent c8876c27c7
commit dd2c2a1f41
14 changed files with 177 additions and 18 deletions

13
c.md
View file

@ -48,13 +48,14 @@ So the standard library (libc) is a subject of live debate because while its int
C isn't perfect, it was one of the first relatively higher level languages and even though it has showed to have been designed extremely well, some things didn't age great, or were simply bad from the start. We still prefer this language as usually the best choice, but it's good to be aware of its downsides or smaller issues, if only for the sake of one day designing a better version of C. So, let's go:
- C specification (the ISO standard) is [proprietary](proprietary.md) :( The language itself probably can't be copyrighted, nevertheless this may change in the future, and a proprietary specs lowers C's accessibility and moddability (you can't make derivative versions of the spec).
- The specification is also long as fuck. A good, free language should have a simple definition. It could be simplified a lot by simplifying the language itself as well as dropping some truly legacy considerations (like [BCD](bcd.md) systems?) and removing a lot of undefined behavior.
- Some things could be made simpler, e.g. using [reverse polish](reverse_polish.md) notation for expressions, rather than expressions with brackets and operator precedence, would make implementations much simpler, increasing sucklessness.
- **C specification (the ISO standard) is [proprietary](proprietary.md)** :( The language itself probably can't be copyrighted, nevertheless this may change in the future, and a proprietary specs lowers C's accessibility and moddability (you can't make derivative versions of the spec).
- **The specification is also long as fuck**. A good, free language should have a simple definition. It could be simplified a lot by simplifying the language itself as well as dropping some truly legacy considerations (like [BCD](bcd.md) systems?) and removing a lot of undefined behavior.
- **Some behavior is weird and has exceptions**, for example a function can return anything, including a `struct`, except for an array. This makes it awkward to e.g. implement vectors which would best be made as arrays but you want functions to return them, so you may do hacks like wrapping them instide a struct just for this.
- **Some things could be made simpler**, e.g. using [reverse polish](reverse_polish.md) notation for expressions, rather than expressions with brackets and operator precedence, would make implementations much simpler, increasing sucklessness.
- Some things like [enums](enum.md) could be dropped entirely, they can easily be replaced with macros.
- The preprocessor isn't exactly elegant, it has completely different syntax and rules from the main language, not very suckless.
- The syntax isn't perfect, e.g. it's pretty weird that the condition after `if` has to be in brackets, it could be designed better. Keywords also might be better being single chars, like `?` instead of `if` or the weird long ass names with spaces like `unsigned long long` could be made nicer. A shorter, natural-language-neutral source code would be probably better. Both line and block comments could be implemented with a single character, e.g. `#` which would end either with a newline or another `#`.
- Some basic things that are part of the standard library or extensions, like fixed with types and binary literals, could be part of the language itself.
- **The preprocessor isn't exactly elegant**, it has completely different syntax and rules from the main language, not very suckless.
- **The syntax isn't perfect**, e.g. it's pretty weird that the condition after `if` has to be in brackets, it could be designed better. Keywords also might be better being single chars, like `?` instead of `if` or the weird long ass names with spaces like `unsigned long long` could be made nicer. A shorter, natural-language-neutral source code would be probably better. Both line and block comments could be implemented with a single character, e.g. `#` which would end either with a newline or another `#`.
- **Some basic things that are part of the standard library or extensions**, like fixed with types and binary literals, could be part of the language itself.
- TODO: moar
## Basics