Re: :anon Subs and Namespaces

2006-12-06 Thread Allison Randal
Matt Diephouse wrote: One common use of anonymous subs in a dynamic language is for later exporting them into another package (or multiple different packages). In that case, you really don't want the sub to retain a link to its defining namespace, you want it to fully adopt the namespace it's p

Re: :anon Subs and Namespaces

2006-11-23 Thread Bob Rogers
From: Allison Randal <[EMAIL PROTECTED]> Date: Wed, 22 Nov 2006 20:37:26 -0800 Ben Morrow wrote: > > ...but that's just a braino on Matt's part, and his point still stands > for the code > > package Test; > > sub apply { > my $func = shift;

Re: Re: :anon Subs and Namespaces

2006-11-23 Thread Matt Diephouse
Allison Randal <[EMAIL PROTECTED]> wrote: Okay, so we're basically solving the same problem as Perl 5's "main" routine, which it stuffs in an obscure C variable internal to the interpreter, not accessible from the symbol table. (Talk about less-than-transparent introspection.) Huh. I don't know

Re: :anon Subs and Namespaces

2006-11-22 Thread Allison Randal
Matt Diephouse wrote: Let's try this again, starting from the Tcl side of things. Tcl code can exist outside of subroutines. This, for example, is a valid Tcl program: set number 5 puts $number [...] But things get a little hairier when we start using namespaces in Tcl: namespace eval t

:anon Subs and Namespaces

2006-11-22 Thread Matt Diephouse
Let's try this again, starting from the Tcl side of things. Tcl code can exist outside of subroutines. This, for example, is a valid Tcl program: set number 5 puts $number In order to compile this to PIR, we have to put it into a subroutine. The only problem with putting it into a subroutine i