In the proposal there is no mention of generic functions.
Take a map function of a Wrapper:

Wrapper<T> {
        func map<U>(transform: T -> U) -> U { ... }
}

let intWrapper = Wrapper(1)
intWrapper.map{ print($0) } // this returns Void


Should the last line be inferred to have a discardable result?

In my opinion a function which returns a generic result should warn for unused 
results in every case. Here, "map" gets a closure with side effects which is 
very unusual and should be handled with another function like "apply".


- Maximilian
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to