[swift-evolution] [Pitch] Move @noescape
Brent Royal-Gordon
brent at architechies.com
Thu Mar 3 17:01:34 CST 2016
> I suppose that makes sense.
Sorry to double-post, but I'm actually rethinking @autoclosure.
My feeling is that we should only attach information to the *type* if it follows the value around and if, at least in principle, it would make sense in at least some other type-like contexts. @noescape fits the bill; I can easily see the semantics and utility of this:
let closure: @noescape Foo -> Bool = { $0.isBar }
But @autoclosure isn't the same way. It's concerned with the syntax used in the parameter list, not the semantics. Perhaps I would feel differently if it were an attribute that said "make this a computed variable bound to an expression which changes every time you set it":
var currentDate: @expression NSDate = NSDate()
if useServerDate {
time = server.currentDate()
}
But that's not what @autoclosure does; it takes an expression, wraps it in a closure, and drops it into an otherwise perfectly normal variable. That just doesn't feel like functionality that should be attached to a type.
--
Brent Royal-Gordon
Architechies
More information about the swift-evolution
mailing list