Open salmanahmad opened 10 years ago
Examples of generic syntaxes:
func(foo(A, C :: A, A => C) {
})
func(A, B)(foo(A, A => B) {
})
func(foo<A, B>(A, A => B) {
})
func(foo(A, B)(x : A, y : B => A) {
})
func(foo(A, B :: x : A, y : B => A) {
})
func(foo(x : generic(A), y: generic(B) => generic(A)) {
})
func(foo(x : A, y : B => A | A, B) {
})
ArrayList(int)()
I also need to consider cases where they are not fully generics, but rather, a function that takes just an Int or a Float. So, I suppose that is overloading, but I need to find a principled way of representing it.
Also, I need to revisit my thoughts on sub typing. I don't think I should include Java-like inheritance, but something needs to be added to allow for sharing common code.
Explore Swift, Scala, and Haskell's implementation of Generics.