On Saturday 01 September 2001 02:15 pm, you wrote: > > I'm still not clear why you specifically want to introduce new grammar > > to implement this, as opposed to, say, the tied example provided > > earlier. > > Because, you have the weird caveat of having to keep the returned > variable around. > > use File::chdir; > > { > my $old_dir = chdir($dir); > } > > The wires are showing through the magician's trick. Wouldn't that be: use File::chdir; { local $cwd = $dir; # Assuming $cwd FETCH and STORE manipulated chdir } ? > > > What are the advantages of having 'local' work with chdir(), compared to > > the disadvantages of having variable scope declarators that are no > > longer limited to variables, but now work with functions? > > That would be probably the best way to do it. Have some sort of hook > that lets you add scope destructors to things. I have no idea how to > do it. Sounds complicated, <obvious troll>probably will never get > done.</obvious troll> Yeah, I couldn't figure it out, either, when I was trying to change the default shell. {snip} > A) I have no idea how to do that. Fair 'nuff. > B) More importantly, *that's* the sort of major redesign I'll leave for > Perl 6. > > I don't want to redesign the language. I just want to get some work > done. It seems to me munging local to handle some functions is more of a language change than adding another variable, since the generic behavior of variables is well-known. Also, one comment on your patch - I saw a doc change for chdir, but I didn't see one for local. -- Bryan C. Warnock bwarnock@capita.comThread Previous | Thread Next