Thus it was written in the epistle of Bart Lateur,
> On Mon, 7 Aug 2000 10:45:01 -0400, Ted Ashton wrote:
> 
> >While I'm not yet prepared to advocate any of the suggestions, *if* lexicals
> >were the default, the above code could be written:
> >
> >         $x = 2;
> >         if (...) {
> >           $x = 1;
> >           ...
> >         }
> >         print "$x\n";
> >
> >Could it not?
> 
> Gee, that is the same situation as we have now, with global variables
> and without strict. The only difference will surface only when your
> project consists of more than one source file: file scoped lexicals vs.
> everything trancending globals.

Perhaps it is, but I've not understood why, could you explain?  As I see it,
if we have the following code now:

$x = 2;
{
  $x = 1;
}
print "$x\n";

we will get the following output:

1

But if lexicals were the default, then the same code would print

2

because it would be equivalent to todays:

my $x = 2;
{ 
  my $x = 1;
}
print "$x\n";

Would it not?

Ted
-- 
Ted Ashton ([EMAIL PROTECTED]), Info Sys, Southern Adventist University
          ==========================================================           
If you ask mathematicians what they do, yo always get the same answer. They
think. They think about difficult and unusual problems. They do not think
about ordinary problems: they just write down the answers.
                                        -- Egrafov, M.
          ==========================================================           
         Deep thoughts to be found at http://www.southern.edu/~ashted

Reply via email to