[swift-evolution] Why doesn't Swift allow a variable and a function with the same name?
Tino Heth
2th at gmx.de
Tue Jan 31 05:55:51 CST 2017
Afaics the motivation has been explained in detail, but actually, you even can declare such a variable as long as it has its own scope:
class Test {
func f(i: Int) {
print(i)
}
func g() {
let f = 1 // hey, works!
print(f)
print(self.f(i:f)) // works as well
}
var f: (Int) -> Void = f // huh?
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170131/1e4e85aa/attachment.html>
More information about the swift-evolution
mailing list