[swift-evolution] [proposal] Allow function argument type to be omitted when passing a default value from which it can be inferred

Pyry Jahkola pyry.jahkola at iki.fi
Wed Jun 8 00:23:22 CDT 2016

> On 07 Jun 2016, at 22:08, Sam Dods via swift-evolution <swift-evolution at swift.org> wrote:
> yes, exactly Doug... the properties at type level are part of the interface and their types can be inferred, so i don't see the difference with function argument types.
> i just find it really bulky when writing something like this:
> func doSomething(thing, withManager: SomethingManager = SomethingManager()) {
>   // prepare the thing
> }

You can get rid of the repetition here by using the implicit member expression syntax (i.e. dot-prefixing the initialiser):

    func doSomething(thing, withManager: SomethingManager = .init()) { ... }

— Pyry

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160608/d7fa7034/attachment.html>

More information about the swift-evolution mailing list