- Proposal: TBD
- Authors: Matthew Johnson, Erica Sadun, Rob Napier
- Status: TBD
- Review manager: TBD
This proposal loosens closure requirements to provide developer flexibility. It removes the _ in
requirement
// I know you meant it to be exaggerated, but I still think this is the better approach in practice: | |
enum ClassError: Error { | |
case propertyNotFound(name: String) | |
case typeMismatch(propertyName: String) | |
} | |
class Foo { | |
var properties: [(String, Any)] = [] | |
private func validateValue(_ value: Any, for property: String) throws { // Note that I pass the name just for the error; that's ok IMO |
This proposal loosens closure requirements to provide developer flexibility. It removes the _ in
requirement
func dispatch_sync<R> (queue: dispatch_queue_t, block: Void -> R ) -> R { | |
var result: R! | |
dispatch_sync(queue) { | |
result = block() | |
} | |
return result | |
} | |
func result() -> String { | |
return |