On Mon, Sep 11, 2006 at 04:35:08AM -0700, Steve Lukas wrote:
> I would argue for: If you declare a lexical twice in the same scope, it is an 
> error! 
> Well, this error happens most likely due to my tiredness and I want the 
> compiler to wake me up. 
> This can be important because I would expect that 
> C< my $x = 7;>
> does not change/overwrite the value of an existing $x. If I want to change 
> the defined $x, I don't declare it again.
> Does anybody agree?

I don't.  I often will do this during early development or debugging:

    my $x = 'some initial state';
    my $x = 'a different state';

I add the second line to try out a different code path.  I do it this
way rather than just change the first line to the second because:

a)  it's easier to restore the initialization back to its original state
    if I change something else,
b)  I won't forget to restore the initialization because I will get a
c)  I can keep a bunch of different states in the file to try and just
    have to cut-and-paste to try a new one, without troubling myself
    with commenting out the unwanted states.

Presumably you will be able to make warnings fatal as in Perl 5 so you
should be able to get the behaviour you want, too.

Rick Delaney

Reply via email to