Generics: Difference between revisions
Jump to navigation
Jump to search
Adamcolton (talk | contribs) |
Adamcolton (talk | contribs) No edit summary |
||
| Line 19: | Line 19: | ||
But this collides the concept of interface substitution. | But this collides the concept of interface substitution. | ||
== Not Turing == | == Not Turing Complete == | ||
The type system should be static and not Turing complete. | The type system should be static and not Turing complete. | ||
* https://arxiv.org/pdf/1605.05274.pdf | * https://arxiv.org/pdf/1605.05274.pdf | ||
Revision as of 12:48, 23 September 2019
I dislike the term generics - it's over broad. But I'll put this here until I can resolve some of the conceptual collisions.
Interface Substitution
See Interfaces. This is the primary form of generics.
Values
I want to be able to do something like:
int<6>
The reason why it's not necessary is that if the call is:
int.new(6)
then at compile time we'll see that it's static and substitute the response.
The reason why we do need it is that
var x int<6> = 123456
is a type and it can't be substituted with a different size
x = int<4>(555) // error
But this collides the concept of interface substitution.
Not Turing Complete
The type system should be static and not Turing complete.
It should also fail quickly in any case that would create an infinite loop (not cause an overflow).