in reply to Re: Defining a function in the caller's package
in thread Defining a function in the caller's package

On second thought, your solution does not work for me, sadly. The problem is that I don't know the package name beforehand. Hence I would have to write something like:

.... do { package $target; ... }
but, as I tried out right now, you can't pass variables to the package statement. Hence I'll have to stick with eval.

-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re^3: Defining a function in the caller's package
by jettero (Monsignor) on Aug 08, 2008 at 12:14 UTC
    Yeah, I noticed that. package should take expression arguments imo... You're pretty much forced to use eval because of that. I imagine there's some trick to set the package using symbol table magic, but it's probably not recommended.

    -Paul