Generics
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.
Value Interface
It maybe possible to do this without extending the base interface substitution concept. We end up with types int of unlimited size and i<n> of a specific size.
If int has a method of int that returns int then we get
type int interface{
int() int
}
And our type of i<6> is
i<bytes int>{
byteArray<bytes>
}
The only catch here is that if the return value of int()int is static, the compiler can figure that out and everything works. If it's not, things may break badly.
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).