> On Mar 11, 2017, at 3:17 PM, Jaden Geller via swift-evolution
> <[email protected]> wrote:
>
> As I understood it, omitting the type would work identically to `let`
> declarations. A string literal without a type defaults to `String`. Treating
> it as a generic function is a bad idea IMO.
>
> I don't think this sugar is worth any amount of added complexity. Most
> function arguments will have not have default values and this have to
> continue to declare the type, so this would only be more concise in very few
> cases. I'd prefer the consistency of always having to explicitly declare the
> argument type at a function boundary.
>
> To call a function, you need to know what type to pass in. This becomes more
> difficult when not make explicit, particularly when a more complicated
> expression is used as a default. -1
When you declare a property with an inferred type, it shows with the explicit
type in the generated interface. So:
public struct S {
public let foo = 3
}
becomes:
public struct S {
public let foo: Int
}
I would presume that the same rule would apply to default parameters in
function declarations (although to be fair, I’m also uncertain that we actually
need this).
Charles
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution