New private names proposal

David Herman dherman at
Wed Dec 22 11:57:59 PST 2010

Hi David,

First of all, I think you may not be reading the current "private names" proposal. Allen wanted to change the name so he created a new page:

Part of what you're reacting against is in fact what he changed (more below). But let me answer your question to provide some background.

> It feels to me as if the private declaration is behaving like a macro.
> Are there precedents for this kind of meta-identifier in other languages?

It might be illuminating to know that this whole line of exploration started when I was reading the documentation for PLT Scheme (now called Racket), which has a library for creating generative, lexically scoped names for use with their object system. You can write:

    (define-local-member-name foo)

and then use `foo' as a property in a class, and only the code in the scope of the `define-local-member-name' can access that property name.

In other words, that's where I got the idea for the original private names proposal. And yes, internally, the implementation defines `foo' as a macro that expands into the gensym'ed name.

What also might be illuminating is the fact that this is part of the Scheme way of doing things, which is never to have more than one lexical environment. So absolutely everything in Scheme shares a single "namespace" -- `define-local-member-name' and macros and keywords and variables and anything fancy new binding forms you can invent (via macros, of course!).

I probably followed this approach without even thinking explicitly about it, because I'm so used to the Scheme Way. :) So my original proposal worked very much the same as `define-local-member-name'.

But Allen convinced me that there are drawbacks to having the single namespace, especially since '.' and ':' are a separate syntactic space from variable references. He reworked the proposal so that `private' binds in a *separate* namespace from variables, so there's no conflict between the two. Take a look at his proposal and see what you think.


More information about the es-discuss mailing list