On Tue, Nov 22, 2005 at 09:42:38AM -0800, jerry gay wrote: > your example in the previous message made me think. what will parrot > do if a parrot sub declares the :outer subpragma, and the sub to which > it refers doesn't have a lexical pad?
Nothing; that's entirely legal. And it's even useful, *if* the outer sub has a :outer of its own. sub foo ($a) { my sub bar { my sub baz { $a } &baz; #note - this returns a reference } bar(); } While &bar has no pad, it does have :outer(foo), so the find_lex in &baz will work. > .sub do_add3 > .const .Sub add3 = "add3" > $P1 = newclosure add3 > $P1() > .end > > .sub add3 :anon :outer(do_add3) > .return ($P1) > .end > > compile error? runtime error? warning only, and error on lexical > access in inner sub? I'd call this correct but silly, kind of like assigning to a register that doesn't get used afterwards. -- Chip Salzenberg <[EMAIL PROTECTED]>