Generics: Difference between revisions
Jump to navigation
Jump to search
Adamcolton (talk | contribs) No edit summary |
Adamcolton (talk | contribs) No edit summary |
||
| Line 18: | Line 18: | ||
But this collides the concept of interface substitution. | But this collides the concept of interface substitution. | ||
== Not Turing == | |||
The type system should be static and not Turing complete. | |||
* https://arxiv.org/pdf/1605.05274.pdf | |||
* https://github.com/Microsoft/TypeScript/issues/14833 | |||
[[Category: Gryphon]] | [[Category: Gryphon]] | ||
Revision as of 12:45, 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
The type system should be static and not Turing complete.