[swift-evolution] [Pitch] Instance var/let property as type member could be unbound function
Tikitu de Jager
tikitu at logophile.org
Fri Mar 4 03:24:16 CST 2016
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.
Cheers,
Tikitu
--
http://www.logophile.org/
@tTikitu
More information about the swift-evolution
mailing list