Nathan Wiger said:
> > What lexical scope should $x be _implicitly_ declared in?  Maybe, just
> > maybe, we need a my $x at the top to tell us it is outside the scope of
the
> > first reference.  Otherwise we get three different lexical variables,
and an
> > undefined value warning at run time.
> ...
> For example, one solution might be that the default lexical scope is
> only delimited on function boundaries:
> ...
This doesn't fix the problem of:
{
  $somevar = 0;
  $someVar++; # oops, wrong case!
}

Forcing 'my' by default allows these errors to be caught.

I'd like to see perl 6 encourage 'clean code' out-of-the-box. Then, People
Who Know What They're Doing can choose to turn on shortcuts as necessary,
but Mere Mortals are encouraged to create mantainable and readable programs.
In this case, 'use strict "vars"' becomes the default behaviour, and a new
'use implicitdeclare "functionlevel"' provides the Lazy behaviour.


Reply via email to