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. Do lots of auto-scoping behind the scenes. 2. Do none. Make the user use my(). However, I don't see this as a valid option: 3. Mostly none. Just a few exceptions, here and there. 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? sub make_it_so ($WARP) { # ... does something ... } make_it_so(9); print "Now travelling at warp $WARP\n"; Ugly? Maybe. But consistent with Perl. Same as this: sub make_it_so { $WARP = shift; } make_it_so(9); print "Now travelling at warp $WARP\n"; -Nate
- Re: RFC: lexical variables made default (... Nathan Wiger
- Re: RFC: lexical variables made defau... Jeremy Howard
- Re: RFC: lexical variables made ... Tom Christiansen
- Re: RFC: lexical variables m... Jeremy Howard
- Re: RFC: lexical variables made default (revi... Nathan Torkington
- Re: RFC: lexical variables made default (... Nathan Wiger
- Re: RFC: lexical variables made defau... Ariel Scolnicov
- Re: RFC: lexical variables made default (... Damian Conway
- Re: RFC: lexical variables made defau... Nathan Wiger
- Re: RFC: lexical variables made ... Johan Vromans
- Re: RFC: lexical variables m... Nathan Wiger
- Re: RFC: lexical variables m... Tom Christiansen
- Re: RFC: lexical variables made default (revi... J. David Blackstone
- Re: RFC: lexical variables made default (revi... Nick Ing-Simmons
- RE: RFC: lexical variables made default Ala Qumsieh
- Re: RFC: lexical variables made default John Porter
- Re: RFC: lexical variables made default Tom Christiansen
- Re: RFC: lexical variables made default John Porter
- Re: RFC: lexical variables made defau... Tom Christiansen
- Re: RFC: lexical variables made ... John Porter
- Re: RFC: lexical variables made defau... Peter Scott