Re: RFC: lexical variables made default (revised)

2000-08-05 Thread Nick Ing-Simmons
Nathan Wiger <[EMAIL PROTECTED]> writes: >> I have retained the title of "Lexical variables made default," >> because I still feel that that is the primary purpose of this change > >First off, I think this is a great idea in principle. However, I don't >think it goes nearly far enough in the imp

Re: RFC: lexical variables made default (revised)

2000-08-04 Thread Tom Christiansen
>I've heard "internal consistency" bandied about a lot. I think >auto-my()ing variables in these sub declarations is a bad idea. >What if you DON'T want them to be my()'ed? Do we have to add a global() >keyword? That's what Python requires. Keeping in mind that Python isn't truly block-scoped,

Re: RFC: lexical variables made default (revised)

2000-08-04 Thread Nathan Wiger
Johan Vromans wrote: > > What would be the semantics if 'my' were left out? Would it be > equivalent to: > > sub whois ($) { > local($user) = @_; > } No. I'd say it should inherit the default global scope. This is *consistent* within Perl. Here's the choices as I see it: 1.

Re: RFC: lexical variables made default (revised)

2000-08-04 Thread Jeremy Howard
Tom Christiansen said: > >This doesn't fix the problem of: > >{ > > $somevar = 0; > > $someVar++; # oops, wrong case! > >} > >Forcing 'my' by default allows these errors to be caught. > > How so? > If the default is to force 'my' to create a lexical, rather than providing a default lexical scope

Re: RFC: lexical variables made default (revised)

2000-08-04 Thread Tom Christiansen
>This doesn't fix the problem of: >{ > $somevar = 0; > $someVar++; # oops, wrong case! >} >Forcing 'my' by default allows these errors to be caught. How so? --tom

Re: RFC: lexical variables made default (revised)

2000-08-04 Thread Johan Vromans
Nathan Wiger <[EMAIL PROTECTED]> writes: > So will these be "automatically-my()ed"? Or will you have to say: > >sub whois (my $user) { ># ... >} > > This seems more consistent (but there's that dang my() again!) :-) What would be the semantics if 'my' were left out? Would it be

Re: RFC: lexical variables made default (revised)

2000-08-03 Thread Ariel Scolnicov
Nathan Wiger <[EMAIL PROTECTED]> writes: > > You've taken the wrong approach. If you're writing a big program then > > there should be *no* default scope. Any variable access is an error > > unless that variable was my()ed or our()ed. That's basically what > > 'strict' gives us. > > Fair enou

Re: RFC: lexical variables made default (revised)

2000-08-03 Thread J. David Blackstone
Tom Christiansen wrote: > > > I have retained the title of "Lexical variables made default," > >because I still feel that that is the primary purpose of this change, > >meaning that in future Perl documentation (books, manpages, classes (I > >hope)) new Perl users will first be presented with va

Re: RFC: lexical variables made default (revised)

2000-08-03 Thread J. David Blackstone
Nathan Wiger wrote: > > > I have retained the title of "Lexical variables made default," > > because I still feel that that is the primary purpose of this change > > First off, I think this is a great idea in principle. However, I don't > think it goes nearly far enough in the implementation.

Re: RFC: lexical variables made default (revised)

2000-08-03 Thread Nathan Wiger
> Besides, named arguments will solve this (in fewer chars even :-)... > >$user = 'nwiger'; >sub whois ($user) { ># ... >} > > Damian Great point. I'll "settle" for that (it's what I'm looking for anyways). :-) So will these be "automatically-my()ed"? Or wil

Re: RFC: lexical variables made default (revised)

2000-08-03 Thread Damian Conway
> However, I do think there's something to be said for a "quick-and-dirty" > script out of the box that can distinguish between sub{} vars and other > vars ala C: > >$user = 'nwiger'; >sub whois { >($user) = @_;# different var ># ... >}

Re: RFC: lexical variables made default (revised)

2000-08-03 Thread Nathan Wiger
> You've taken the wrong approach. If you're writing a big program then > there should be *no* default scope. Any variable access is an error > unless that variable was my()ed or our()ed. That's basically what > 'strict' gives us. Fair enough. I've heard several good analyses against my idea,

Re: RFC: lexical variables made default (revised)

2000-08-03 Thread Nathan Torkington
Nathan Wiger writes: > I argue we should fundamentally shift this thinking in Perl 6. Let's > truly have "lexical variables made default". Ugh. Baby, bathwater. If I'm writing a big program, then I want to have to declare all variables so that Perl can catch errors for me. That's the big benef

Re: RFC: lexical variables made default (revised)

2000-08-03 Thread Jeremy Howard
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. >

Re: RFC: lexical variables made default (revised)

2000-08-03 Thread Nathan Wiger
> 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. You're right, great point. T

Re: RFC: lexical variables made default (revised)

2000-08-03 Thread Glenn Linderman
The problem with lexical variables being made default, in earnest, is simple, and error-prone: code; if ( condition ) { more code; $x = 'did then''; } else { more code; $x = 'did else'; } print $x; What lexical scope should $x be _implicitly_ declared in? Maybe, just maybe, we need a my $x

Re: RFC: lexical variables made default (revised)

2000-08-03 Thread Nathan Wiger
> I have retained the title of "Lexical variables made default," > because I still feel that that is the primary purpose of this change First off, I think this is a great idea in principle. However, I don't think it goes nearly far enough in the implementation. I'd like to propose something rad

Re: RFC: lexical variables made default (revised)

2000-08-03 Thread Tom Christiansen
> I have retained the title of "Lexical variables made default," >because I still feel that that is the primary purpose of this change, >meaning that in future Perl documentation (books, manpages, classes (I >hope)) new Perl users will first be presented with variables declared >as lexicals with

Re: RFC: lexical variables made default (revised)

2000-08-03 Thread J. David Blackstone
John Tobey wrote: > > "J. David Blackstone" <[EMAIL PROTECTED]> wrote: > > Thanks for the feedback, everyone. I now believe that what we > > really want is what so many have suggested, i.e., making strict 'vars' > > the default (in essence, at least). > > Sorry if this was mentioned already.

Re: RFC: lexical variables made default (revised)

2000-08-03 Thread John Tobey
"J. David Blackstone" <[EMAIL PROTECTED]> wrote: > Thanks for the feedback, everyone. I now believe that what we > really want is what so many have suggested, i.e., making strict 'vars' > the default (in essence, at least). Sorry if this was mentioned already. If this change is adopted, I wou

RFC: lexical variables made default (revised)

2000-08-03 Thread J. David Blackstone
Thanks for the feedback, everyone. I now believe that what we really want is what so many have suggested, i.e., making strict 'vars' the default (in essence, at least). I have retained the title of "Lexical variables made default," because I still feel that that is the primary purpose of thi