The answer is simple, it becomes ambiguous about whether it should get the var or the function pointer<br><br>Suppose we could do this<br><br>let r = 5<br>func r() {}<br><br>If we call r, should we get 5 or should we get ()->()<br><br><br><div class="gmail_quote"><div dir="ltr">On Mon, Jan 30, 2017 at 4:21 PM Sean Heber via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I used to believe this was a problem, but once I internalized the idea that this ugliness was a signal to choose better variable and property names, it has ceased to be an issue for me and in fact, IMO, has become an asset of the language.<br class="gmail_msg">
<br class="gmail_msg">
l8r<br class="gmail_msg">
Sean<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
> On Jan 30, 2017, at 3:17 PM, Jaden Geller via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:<br class="gmail_msg">
><br class="gmail_msg">
> I personally find it kind of weird that `let x = 0; do { let x = x + 1 }` is disallowed but `let x: Int? = 0; if let x = x { }` is allowed. The former case requires you first rename the variable you plan to shadow, inconveniently:<br class="gmail_msg">
><br class="gmail_msg">
> ```<br class="gmail_msg">
> let x = 0<br class="gmail_msg">
> do {<br class="gmail_msg">
> let tempX = x // ew<br class="gmail_msg">
> let x = tempX + 1<br class="gmail_msg">
> }<br class="gmail_msg">
> ```<br class="gmail_msg">
><br class="gmail_msg">
>> On Jan 30, 2017, at 11:56 AM, Robert Widmann via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:<br class="gmail_msg">
>><br class="gmail_msg">
>> This seems like it’s running through the same check that disallows defining and calling a closure<br class="gmail_msg">
>><br class="gmail_msg">
>> let randomFunc : () -> () = randomFunc()<br class="gmail_msg">
>><br class="gmail_msg">
>>> On Jan 30, 2017, at 2:37 PM, Michael Gubik via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:<br class="gmail_msg">
>>><br class="gmail_msg">
>>> Example that does not compile:<br class="gmail_msg">
>>><br class="gmail_msg">
>>> let randomArray = randomArray(withCapacity: 4096)<br class="gmail_msg">
>>><br class="gmail_msg">
>>> Compiler error: “Variable used within its own initial value”<br class="gmail_msg">
>>> The variable name unfortunately clashes with the function name.<br class="gmail_msg">
>>><br class="gmail_msg">
>>> This problem forces the developer to think about an alternative name.<br class="gmail_msg">
>>> IMHO that’s suboptimal since many times the most canonical naming would be one where these two go by the same name.<br class="gmail_msg">
>>><br class="gmail_msg">
>>> It’s not a big problem in practice but I wonder if there are plans to change this?<br class="gmail_msg">
>>><br class="gmail_msg">
>>><br class="gmail_msg">
>>> Thanks,<br class="gmail_msg">
>>> Michael Gubik<br class="gmail_msg">
>>><br class="gmail_msg">
>>> _______________________________________________<br class="gmail_msg">
>>> swift-evolution mailing list<br class="gmail_msg">
>>> <a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
>>> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
>><br class="gmail_msg">
>> _______________________________________________<br class="gmail_msg">
>> swift-evolution mailing list<br class="gmail_msg">
>> <a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
>> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
><br class="gmail_msg">
> _______________________________________________<br class="gmail_msg">
> swift-evolution mailing list<br class="gmail_msg">
> <a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</blockquote></div>