+1 from me, it seems like a sensible improvement (albeit not a pressing one, as others have noted).
Just imagining the future. Iff this request will made into the language and we had typealias AnyObject = Any<class>, would the following be valid?
extension AnyObject {
func foo()
}
···
--
Adrian Zubarev
Sent with Airmail
Am 6. Februar 2017 um 08:03:52, Vatsal Manot via swift-evolution (swift-evolution@swift.org) schrieb:
+1 from me, it seems like a sensible improvement (albeit not a pressing one, as others have noted).
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution
If I understand correctly, extension of a typealias should be strictly
equivalent to extension of type on the right:
extension Any<class> {
func foo()
}
And Any<...> are not nominal types, so until we additionally allow
extensions for non-nominal types, this will not compile.
Just imagining the future. Iff this request will made into the language and
···
2017-02-06 20:51 GMT+03:00 Adrian Zubarev via swift-evolution < swift-evolution@swift.org>:
we had typealias AnyObject = Any<class>, would the following be valid?
extension AnyObject {
func foo()
}
Right.
Note that we capriciously banned extending AnyObject so y’all couldn’t sneak in code that would prevent AnyObject from turning into “an existential describing values of class type” :)
- Doug
···
On Feb 6, 2017, at 10:06 AM, Anton Zhilin via swift-evolution <swift-evolution@swift.org> wrote:
If I understand correctly, extension of a typealias should be strictly equivalent to extension of type on the right:
extension Any<class> {
func foo()
}
And Any<...> are not nominal types, so until we additionally allow extensions for non-nominal types, this will not compile.
Okay fine. I’m curious if we ever should be able to extend existentials. (Could be really handy.)
typealias FooView = UIView & Foo
extension FooView {
func foo() { .. }
}
// vs.
extension UIView where Self : Foo { .. }
···
--
Adrian Zubarev
Sent with Airmail
Am 6. Februar 2017 um 19:06:16, Anton Zhilin (antonyzhilin@gmail.com) schrieb:
If I understand correctly, extension of a typealias should be strictly equivalent to extension of type on the right:
extension Any<class> {
func foo()
}
And
Any<...> are not nominal types, so until we additionally allow extensions for non-nominal types, this will not compile.
2017-02-06 20:51 GMT+03:00 Adrian Zubarev via swift-evolution <swift-evolution@swift.org>:
Just imagining the future. Iff this request will made into the language and we had typealias AnyObject = Any<class>, would the following be valid?
extension AnyObject {
func foo()
}