quildreen at gmail.com
Wed Nov 2 08:15:47 PDT 2011
On 02/11/11 13:01, David Bruant 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, ....)
> 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?
Yeah, immutability and referential transparency are wonderful things. I
to work with. Though is `const' the same as Object.freeze(thing) when
`thing' is an object? Or does it just ensure that the slot in the object
> 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.
I still think `private' is quite overrated. It gets terrible if you want
to test something and the developer went through all the trouble of
making proxies to access everything, as well as making everything stateful.
That said, there are some valid use-cases for it... I guess?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss