At 03:30 PM 8/6/00 -0400, Ken Fox wrote: >Dan Sugalski wrote: > > At 02:09 AM 8/6/00 -0400, Chaim Frenkel wrote: > > > uplevel 0, $Perl:Warnings=1; # Hit everyone > > > uplevel -1, $Perl:Warnings=0; # Hit my wrapper > > Yeah, I can see that. We're going to need a mechanism to hoist things to > > outer scope levels internally (for when we return objects from subs) so it > > might be worth generalizing things. > >Huh? I'm not sure if Chaim is proposing the same thing as Tcl's upvar, >but that's a hack to Tcl just to get pass-by-ref semantics. I'm not fond >of Tcl's uplevel hack either. Perl's already got references, dynamic >variables *and* lexical closures; we don't need Tcl's hacks. Well, the issue is with end-of-scope actions. The current way of doing things is to call DESTROY pretty much immediately upon the refcount going to zero. That's keen. But, if we toss refcounts, and split GC cleanup and end of scope actions anyway, we need to have a mechanism to hoist things out of the current scope. If you've got this: sub foo { my $obj = new Thing; return $obj; } you certainly don't want to go doing end of scope cleanup on $obj when the sub exits, since you've returned it. That means hoisting its end of scope actions out a level (or twelve) to at least the sub caller, if not further. >It isn't clear to me why things like warnings can't be a flag on the >current lexical environment. It should be cheap enough to get at a flag >on the environment. (We already have a proposal to identify the magical >function __ at compile time. We might as well generalize that and identify >flags too.) Warnings (and possibly tainting, or the default shell, or whatever) can well be lexically scoped--that's not a problem. We already do some of that, and we can certainly do more easily enough. Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk