New private names proposal

David Flanagan david at
Wed Dec 22 11:37:29 PST 2010

More musings: the current proposal allows this form where the generation 
of the private name is explicit:

	private x = new Name();

What if the silently generative form were not allowed?  That would make 
the mapping of identifiers more explicit.

And if so, could we replace = with a token that indicates mapping?

	private x <=> new Name();

What about mapping public identifiers to other public identifiers?

	private cos <=> "cosine"  // Now I can write Math.cosine()

If that is allowed then the private keyword no longer makes sense.

How about something like the let statement:

         var privateX = new Name(), privateY = new Name()
	for (x,y) use (privateX, privateY) {
	    // Identifier mapping scoped to this block

Or flip the for and use clauses around if that looks too much like a loop:

	use(new Name(), new Name()) for (x, y) {}


More information about the es-discuss mailing list