3 ms·
Not sure where I was reading this the other day, but types have two advantages: abstraction and checking. You can add a third one to that list: safety. C has
by Eridrus 12y ago
Not sure where I was reading this the other day, but types have two advantages: abstraction and checking.
You can add a third one to that list: safety.
C has types in the sense that it allows you to do abstraction, and type checking, but it doesn't enforce safety.
2/3 doesn't seem bad to me, especially for a systems language.
I'd say that Typescript is in a similar position, you can cast anything to any type you want and there is no runtime check to stop you, but it helps you add structure to your code.
Types do very much matter in these languages in practice, since you want to very much want to avoid writing a giant mess.
- vegedor 12y agoOf course C has safety features for the type system, warnings for problematic casts, and structs that can't be cast unless specifically unionized and explicitly ordered to.