shortcuts for defining block-local private names, plays nicely with @foo syntax

Gavin Barraclough barraclough at
Mon Jan 23 01:00:46 PST 2012

On Jan 22, 2012, at 10:29 PM, Brendan Eich wrote:

>> 1) should .@ member access and @ object literal property definitions permit he property key to be any toString-able value and not just private name values?  The current plan of record does not require a private name value in the analogous contexts.
>> I'm slightly inclined towards requiring private name values, but would be happy either way.
> As noted above, I'm inclined toward requiring private name objects on the right of @.

It seems like an unfortunate inconvenience to require any code refactoring and lose the shorthand @ this-access if you just want to make a private property on an object be public.  Instead of just restricting the token to the right of a @ or .@ construct be a private name, perhaps it would be useful to also permit an explicitly declared public name?

	private x,y;
	function point(x,y) {
		@x = x;
		@y = y;

can easily be transformed into:

	public x,y;
	function point(x,y) {
		@x = x;
		@y = y;

This would still provide a guard against typos, whilst giving convenient access to public properties on the this object.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list