FAQ

On 02/19/2013 08:20 AM, Johann Höchtl wrote:

[...] The variable "found" is hidden. This is clearly a mistake yet get's
unspotted by the current compiler. [...]
I would propose another radical solution for this: Simply that shadowing
variables is not allowed. When you are about to shadow a variable, use a
different variable name.

I mean this really serious; compared to C, Go made some useful
restrictions, limiting the programmer's freedom in some way, like the
mandatory use of { } in all if's anf for's. Forbidding variable
shadowing could be one more such thing. I could live with that
restriction very well.

Of course this would mean a major change in the language specification,
something not before Go 2...

Norbert

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

People

Translate

site design / logo © 2021 Grokbase