5 ms·
So, Ada modular types are just like C uint ?
by alcover 3y ago
So, Ada modular types are just like C uint ?
- Jtsummers 3y agoExcept that it allows for an arbitrary modulus. For instance, you can have: type Whatever_Name is mod 10; Removing restrictions is nice, lets the language and its type system actually express parts of the program logic unlike the inexpressive type system C provides.
- alcover 3y agoOk that's nice. Would one call that a dependent type ? I guess I would naively implement this by appending %10 to all assignments to a Whatever_Name.
- Jtsummers 3y agoNo. Dependent types go further and allow you to do things like express that the length of an output vector/array is the same as some input number. That is, depends on some value (as in a runtime value). This mod type is fixed at compile time.