Hi,

On Jul 2, 2008, at 18:36 , kangax wrote:

>> Prototype doesn't provide any special facility for defining "static"
> members (as majority defines it). All it takes is to declare them as
> members of "class" function.
>
> var Foo = Class.create({ ... })
> Foo.blah = 'my static property';

Yeah, that's what I do and it works just fine.

>>> So, with that - just do what darrin suggests (which is the best way
>>> to ensure your instance methods are truly instance only methods)...
>>> or attach them directly to the prototype object after Class.create()
>>> is called.
>>
>> I think I'll just have a special method called in .initialize that
>> will map the getters and setters automatically. I was just hoping  
>> that
>> Prototype might already have a way to deal with JS getters and  
>> setters
>> outside of the constructor.
>>
>
> You could do that, though "fat" constructors is usually not a good
> idea. It would also cripple performance if constructor is called
> frequently.

I think it might be worth asking for JS getters and setters to be  
handled directly by Class.create(). I'll try to add support for them  
in Class.create() and submit a patch...

Antoine

--~--~---------~--~----~------------~-------~--~----~
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