On Jul 2, 1:12 pm, "Ryan Gahl" <[EMAIL PROTECTED]> wrote:

> Of course there are. To say otherwise is confusing.

I'm not sure I understand what you mean, Ryan.
JavaScript doesn't have a notion of "static" (except for a reserved
keyword that's not even implemented). There are "direct" members and
members shared via object's [[Prototype]]. Since prototype.js
simulates "classes" a reasonable definition of static would be:
properties of a Function object created via Class.create. The way
Antoine put it sounds confusing to me (and I'm sure to other folks as
well)

> You could do that, though "fat" constructors is usually not a good
>
> > idea. It would also cripple performance if constructor is called
> > frequently.
>
> Not true at all. "fat" constructors? Let's not make up FUD terms here :)
>

Doesn't really matter how we call it : )
Having bunch of logic in constructor is not a good design (in my
experience)

> The truth is, defining methods and properties from within the constructor is
> the ONLY way to achieve truly instance only members, and the only way to

"instance only" members could be easily created by assigning functions
to properties of object's prototype. I don't see a need for
constructor.

> create truly private/public members on the instance (instead of people just
> adding an underscore character to a public member and calling it private).
>
> For 95% of classes, there will be no noticeable performance issues.

It's obviously a matter of priorities. For me, performance is usually
one of the key factors. Simulating "private" properties (in a highly
dynamic language) does not compensate for the decreased speed.

-- kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to