Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct SA<T> {
- let v: T
- init(_ v: T) { self.v = v }
- }
- typealias SB = SA<(Int, Int)>
- typealias SC = SA<W>
- typealias W = (Int, Int)
- struct SD {
- let v: (Int, Int)
- init(_ v: (Int, Int)) { self.v = v }
- }
- let a = SA(1, 2) // Works with zero or more parens around 1, 2 (not counting arg list parens).
- let b = SB(1, 2) // Works _only_ with zero parens.
- let c = SC((1, 2)) // Works with with one or more parens.
- let d = SD((1, 2)) // Works with with one or more parens.
- // To me, the types of a, b, c and d are as similar as different types can be.
- // Yet they are very different in the way they can be initialized, why?
- // How come SB and SC must be initialized differently for example?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement