On 2 avr, 11:42, "Ryan Gahl" <[EMAIL PROTECTED]> wrote:
> > This sounds good, in theory, but only if everything is declared inside
> > the inditialize function.
>
> Which is as it should be if your are really talking about class methods (i.e.
> instance only members).
>
> See my blog post on this subject, which offers up a nice, prototype-y
> inheritance model and leave Object.extend alone (because it is useful as is
> for bulk object property copying in other places besides inheritance):
>
> http://www.someelement.com/2007/03/multiple-inheritance-with-prototyp...
>
> I also speak to the whole "true" class level member issue and address the
> bad habit of tacking said members statically onto the object's prototype.
> The first part of the post does give examples using that way, just because I
> know that's what people are used to.
>
> Give it a read. Object.inherit is very useful.


Yes, I just tried it, and it works nicely. I wrote some Observable/
Observer generic classes that other classes may extend to benefit from
an Observer pattern to test the functionality (java-like).

Though, I was wondering the possibility to write some sort of
Class.create(); with parameters.... something like :

var Class1 = Class.create( baseClass /* , baseFuncName */ );

for single inheritance, or :

var Class1 = Class.create( [ { baseClass: baseClass /*, baseName:
baseFuncName */ }, ... ] );

for multiple inheritance.

Perhaps even add, as last parameter, an object to set as prototype,
and yet get rid of every Object.extend(). Such as :

Class.create( prototype );    // for no inheritance
Class.create( baseClass, prototype );  // or Class.create( baseClass,
baseName, prototype );
  and
Class.create( baseClassArray, prototype );

(Is that going too far ?)

I'm asking before throwing myself in anything, as you probably had
thought about it. Thanks though for the article, it was very
instructive.

-yanick


--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
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