[r6rs-discuss] bound identifier predicate
ramana.kumar at gmail.com
Sun Jun 21 20:31:11 EDT 2009
If you could create an identifier whose wrap was known to be empty
(i.e. had no substitutions), then your trick with free-identifier=?
would work for imports and top-level definitions as well as
lower-level (e.g. let) bindings. That's why I asked whether such a
guarantee of an empty wrap could be made for the results of
Relying on the subtleties of free-identifier=? and
generate-temporaries would not be ideal, however. Since you "see no
way of identifying what is bound and what is not at the root level of
a library form or at the top-level using a simple technique", I
contest that a primitive bound-identifier? is wanting.
On Mon, Jun 22, 2009 at 10:21 AM, Aaron W. Hsu<arcfide at sacrideo.us> wrote:
> On Sun, 21 Jun 2009 03:03:42 -0400, Ramana Kumar <ramana.kumar at gmail.com>
>> Aaron you have a good idea, but the choice for #'a is much more
>> important than it seems. For example, if you define your
>> bound-identifier? macro at the top level of some library or script
>> that imports (rnrs), then it will incorrectly say "define" (and other
>> (rnrs) imports) is unbound. You are inadvertently picking up the wrap
>> of the identifier #'a.
> This is neither unintentional nor unexpected. As I mentioned, the whole
> reason this works is because I am grabbing the top-level wrapping on a
> syntax and using that to introduce a binding of the same form as the first.
> The code I gave only works for lexically scoped values, and not for imported
> or top-level definitions. As you know, the reason that this works is because
> I am created a top-level syntax that has the same reference as the given
> identifier would *if* the identifier is not scoped at some later point, such
> as inside of a LET or the like. The definition of 'free-identifier=?' states
> that all identifiers are presumed to be explicitly bound at the top-level.
> This makes it impossible to distinguish whether an identifier is bound at
> the top level or not using 'free-identifier=?'. Thus, I can see no way of
> identifying what is bound and what is not at the root level of a library
> form or at the top-level using such a simple technique.
> Aaron W. Hsu
> Of all tyrannies, a tyranny sincerely exercised for the good of its victims
> may be the most oppressive. -- C. S. Lewis
More information about the r6rs-discuss