extension Int : CustomStringConvertible {
var description: Swift.String {
get {}
}
}
my proposal is to expose
Int.description
as a function with type
(Int) -> String
This would make var/let properties behave more similarly to func properties, where given
extension Int : PartOfRandomAccessIndexType {
func successor() -> Swift.Int
}
we have
Int.successor
exposed with type
(Int) -> () -> Int
Making var/let properties behave "the same" looks more consistent to me, but that's as a naive Swift user with no real compiler/language-design experience. For the same reason I can't see whether this would impact the ABI, whether it's remotely feasible, and even whether what looks like "the same" behaviour to me is *really* semantically equivalent. So if there is some interest in this idea I'd be happy to work up a formal proposal, but I thought I would test the waters first.
+1. This would be very nice to have when dealing with computed properties.
···
--
Richard
On Mar 4, 2016, at 1:24 AM, Tikitu de Jager via swift-evolution <swift-evolution@swift.org> wrote:
That is, given
extension Int : CustomStringConvertible {
var description: Swift.String {
get {}
}
}
my proposal is to expose
Int.description
as a function with type
(Int) -> String
This would make var/let properties behave more similarly to func properties, where given
extension Int : PartOfRandomAccessIndexType {
func successor() -> Swift.Int
}
we have
Int.successor
exposed with type
(Int) -> () -> Int
Making var/let properties behave "the same" looks more consistent to me, but that's as a naive Swift user with no real compiler/language-design experience. For the same reason I can't see whether this would impact the ABI, whether it's remotely feasible, and even whether what looks like "the same" behaviour to me is *really* semantically equivalent. So if there is some interest in this idea I'd be happy to work up a formal proposal, but I thought I would test the waters first.