by greg7mdp · 6y ago · 0 comments
but not in C because C has no scope
When you write "a + b", you won't end up with kilobytes of machine code just because someone in some header overloaded the + operator.
Ditto for template-style generics and overloaded functions. If you call a function and it doesn't exist, it won't get auto-generated for you on the fly. You get an error. You want a function, you define that function. That's not the flaw of the language. That's its strength.
Ditto for switch-case constructs.
Ditto for closures.
All of these constructs, should they be added to the language, will result in a compiler generating heaps of code from a simple code snippet. But this will no longer be C, because in C what you see is what you get.
ATS :p
When I learned it I wondered why would somebody use it instead of Rust or Idris.