[Proto-Scripty] Re: Opinions appreciated on approach to Getters and Setters.

2009-03-10 Thread Tobie Langel
JavaScript let's you do proper encapsulation using closures like so: function Person(name) { this.setName = function(value) { name = value; } this.getName = function() { return name; } } There's a memory cost to this, though: every instance of the Person class will get it's own

[Proto-Scripty] Re: Opinions appreciated on approach to Getters and Setters.

2009-03-10 Thread webbear1000
Thanks for the replies guys. Sometimes JS's flexibility can catch me out. I guess there is no right or wrong way to do anything. Just things to consider. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype

[Proto-Scripty] Re: Opinions appreciated on approach to Getters and Setters.

2009-03-09 Thread kangax
On Mar 9, 9:50 am, webbear1000 normpo...@hotmail.com wrote: I'm interested in your opinions on how I'm handling getters and setters in classes. Can you see any problems with my approach and what trouble might I be getting myself into? The huge body of my programming work has been with