Subject: Re: Accessing enclosed symbol. From: Erik Naggum <email@example.com> Date: 18 Oct 2002 16:57:51 +0000 Newsgroups: comp.lang.lisp Message-ID: <firstname.lastname@example.org> * Jacek Generowicz | OK, last try ... could you suggest a better subject line for my | original message? Well, no. What you try to do is almost trivial, as the snippet of code I wrote to handle it shows. But I think I understand why you think this is a big deal and I do not. You want to create a mini-environment in which you can refer to bindings in a slightly different way than normal lexical scope, and not quite in dynamic scope, either. However, I see no need to go outside the normal lexical scope as you have explained things so far and I am sort of waiting to hear more from you why you think so. Perhaps things could be eased for you with symbol macros? You can then set up an environment that will map a symbol to a function call that may well be a closure that captures the symbol's value from an environment other than your lexical environment. Symbol macros can be defined both globally and locally. See `define-symbol-macro´ and `symbol-macrolet´. Perhaps you really need a dynamic environment for your mini-"language"? Setting it up with `progv´ is easy and straightforward and if you make no internal bindings in your mini-language, will effectively be identical to a lexical environment created on the fly. You can then use `eval´, too. If I understand your problem description correctly, you have ventured down a blind alley and ask us to help you break through one of the walls around you. I try to help you turn back to where you came from and make a different choice. It is not unlike rats in mazes. Some quickly learn that scaling the walls does not work, while others do not. Some act like believers in their prior understanding of the concept and curse the walls (apologies for the anthropomorphism) and try to claw their way through them. Some figure out that blind alleys are no good and learn to spot them early enough that they do not have to back up very often. In human terms, the stronger you believe that you have found a good solution the more effort and setbacks you are willing to accept. You find people who go "this should do it! <pause> shit!" over and over. Sometimes, less faith in one's ability to intuit solutions before knowing the subject at hand can do wonders for the ability to find really good solutions. Also see my current and long-standing .signature. -- Erik Naggum, Oslo, Norway Act from reason, and failure makes you rethink and study harder. Act from faith, and failure makes you blame someone and push harder.