Generics

From Adam Colton
Revision as of 12:39, 23 September 2019 by Adamcolton (talk | contribs)
Jump to navigation Jump to search

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.