On Tue, Aug 30, 2011 at 2:37 AM, Rob Williscroft <r...@rtw.me.uk> wrote:


> > That's brilliant and works flawlessly.  Thank you very much!
>
> If an impementation (as you say up thread) can populate globals
> or locals with whatever they want, then how do you know that last
> item added was the function definition the user supplied ?
>
> Rob.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


I spoke a bit too soon with the "works flawlessly" post.  In addition to
your issue, there is also the problem that supplying an empty environment
does not allow the user to call necessary functions (like scheme_eval).


Why not just get the name from the user
>

That's probably what I'll end up doing, something similar to:

special_forms = {}

def exec_func_def(symbol, def_string, name=None):
  exec(def_string)
  if name is None:
    special_forms[symbol] = f
  else:
    special_forms[symbol] = eval(name)

It just feels kind of hackish to me, when what I really want to do here is
eval an anonymous function.

-- 
Nick Zarczynski <http://www.rentageekit.com>
Pointless Programming Blog <http://pointlessprogramming.wordpress.com>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to