[Swift-devel] multiple declarations of variables.

Michael Wilde wilde at mcs.anl.gov
Fri Nov 23 14:44:50 CST 2007


that sounds good.

On 11/22/07 1:10 PM, Ben Clifford wrote:
> At present, the language allows multiple declarations using the same 
> variable name resulting in the second variable shadowing the first.
> 
> eg:
> 
>> file i;
>> file i;
> 
> (which is fairly obvious)
> 
> but also:
> 
>> file foo <"myfile">;
>> file foo = f(x);
> 
> I've seen multiple declarations like this confuse a few people in that 
> past.
> 
> I'd like to make variable shadowing illegal - either of the above should 
> result in a compile time error (or at least a warning).
> 



More information about the Swift-devel mailing list