> On 16 Mar 2017, at 16:53, Zach Waldowski <[email protected]> wrote: > >> On Mar 16, 2017, at 3:09 AM, David Hart via swift-evolution >> <[email protected]> wrote: >> >> 2) Libraries like Marshal (https://github.com/utahiosmac/Marshal) and Unbox >> (https://github.com/JohnSundell/Unbox) don’t require the decoding functions >> to provide the type: those functions are generic on the return turn and it’s >> automatically inferred: >> >> func decode<T>(key: Key) -> T >> >> self.stringProperty = decode(key: .stringProperty) // correct specialisation >> of the generic function chosen by the compiler >> >> Is there a reason the proposal did not choose this solution? Its quite sweet. > > IMHO those are only “sweet” until you need to decode a value out to something > other than a typed value, then it’s ambiguity city.
Other than a typed value? Can you give an example? > There are many ways to solve that, but none of them are conducive to > beginners. Using the metatype to seed the generic resolution is the only > thing I’d get behind, personally. > > Zach Waldowski > [email protected] >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
