Last active
January 28, 2018 03:11
-
-
Save jrsonline/731b43af8a8efcab0fc572d874329950 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// suppose we have some class | |
class AClass<A> { required init() {} } | |
// we can certainly create a generic type using that class | |
// note that we are "hard coding" creating an AClass object | |
struct GenericType<A> { var a = AClass<A>() } | |
let ta = Type<Int>() | |
// ...but we can't tell Swift what sort of object to create | |
// eg we cannot be generic in the 'AClass' | |
// the T<A>() doesn't work | |
// ie: we can't generalize the Type Constructor T<A>() | |
struct HigherType<T : AClass,A> { var a = T<A>() } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment