On Sunday, 24 November 2013 at 14:32:16 UTC, ilya-stromberg wrote:
On Sunday, 24 November 2013 at 14:16:39 UTC, bearophile wrote:
Maxim Fomin:

This is neither bug not a terribale feature.

I think the implicit question of ilya-stromberg was: how much bug-prone is this language feature?

Yes, exactly. I personally was VERY surprised. My code example from real life:

class Foo
{
}

class Bar
{
        Foo f;
        
        void bar()
        {
                //variable was wrongly commented here
                //bool f = true;
                
                if(f)
                {
                        //Oops!
                }
        }
}

This is identifiers shadowing issue. In best case you could not define boolean f, so the problem would not arise in a first place. Anyway, many artifical examples can be provided which shows that some features behave in unexpected ways which is not a reason that they are bad.

Reply via email to