[Swift-devel] multiple declarations of variables.

Ben Clifford benc at hawaga.org.uk
Thu Nov 22 13:10:58 CST 2007


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