On Nov 2, 2011, at 8:25 AM, Kam Kasravi wrote:

> Does object@name break encapsulation? One could mutate object@name for any 
> instance of the class passed in via a parameter for example. 

At the Nov. 2008 TC39 meeting, we agreed on class-private instance variables, 
not instance-private ivars. There's no "break encapsulation" -- this is a 
difference in point of view. Classes are the locus or privacy, not instances. 
You cannot access a class-private ivar outside of the class's methods.

/be


> 
> On Nov 2, 2011, at 8:01 AM, David Bruant <[email protected]> wrote:
> 
>> Le 02/11/2011 14:26, Jeremy Ashkenas a écrit :
>>> 
>>> (Full Disclosure: I'm still very opposed to const, private, and their 
>>> object-lockdown friends, ....) 
>> Could you elaborate on this point? 
>> All object-lockdown I can think (non-configurability, non-writability, 
>> non-enumerability, private names, const variables, const classes) of is 
>> optional. Why are you against them?
>> 
>> Regarding "const", it's an optional keyword basically telling the 
>> interpreter "hey, the value isn't suppose to change at runtime, please 
>> ensure it!". It prevents bugs of mistakenly redefining something that 
>> shouldn't be redefined. Why are you opposed to this?
>> 
>> Regarding "private", I'm puzzled. Having private attributes in objects is 
>> necessary to implement encapsulation and get all the benefits of good 
>> object-oriented practices.
>> A generation of JS programmers have used scope constructs and the "var" 
>> keyword to enable some privacy. I'm all in favor of providing a declarative 
>> support for what people have done for years anyway. What is wrong with 
>> "private"?
>> 
>> Once again, all of this is optional, nothing forces you to use new features 
>> of the language. I will personnally never use multi-line strings, but I 
>> don't mind the feature being in the language.
>> 
>> I was about to say "if you're unsatisfied, create a language which doesn't 
>> provide features you don't like, like Coffeescript", but... humm...
>> So, why being against the introduction of features in the language?
>> 
>> David
>> _______________________________________________
>> es-discuss mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to