:) That feels good - someone using my stuff...

Clearly, I'd say if my model works, and theirs doesn't (for your needs),
simply stick with mine -- mine works for me for all cases so I haven't even
touched or in any way played with or looked at the 1.6 stuff.

I will say this - proto core team, please keep stuff in testing state
longer, and think outside the box when testing. There was a post yesterday
about the IE onContentLoaded emulation via the script tag, and I know that
technique poses problems (also in Ext), when the library files are loaded
dynamically on-demand (i.e. well after the page has loaded). When I told
Jack Slocum about the issue in Ext he did not want to fix it because he
never intended for the lib to be pulled in on-demand... I hope for better
from you guys :)

This is not to say you're not doing a wonderful job, just be sure to be
extremely diligent please.

If this inheritance model does not support true OO, where private and public
member access is encapsulated in the class constructor (explained in my post
cited by the OP), rather than having "_private" and "public" "instance"
members tacked onto the prototype object (which are just all what I call
"prototype-static" and neither truly private nor truly "instance only
members")... then you can't really say the model is ready for prime time.
Now, this does not affect me, as I have my model and it works for arbitrary
cases... but if yours does not work for arbitrary cases, then it doesn't
work.

If, in the base class constructor, you do "this.member = ..." - the expected
behavior for inheritance should always be that the subclass instances also
have a public member called "member".

Note: my model is truly the bee's knees (with full credit to Kevin Lindsey
of course for the original implementation) - fully tested and in place in
large production projects (Mashery's reporting system for one). Not trying
to be a braggard here (especially since I didn't think of the original
theory) - just saying, why not just use something that's proven to work and
supports arbitrary cases? N levels of inheritance, multiple inheritance if
needed, true OO accessor levels, and you can even put back in the "super"
stuff that I removed, although it is not needed (see my blog post).

I won't push the matter of course, but I did suggest the same back when you
started down this path...

On 9/27/07, Yanick <[EMAIL PROTECTED]> wrote:
>
>
> I am upgrading from 1.5.1 to 1.6 and, while trying to use the
> inheritance system from Prototype, I'm a little puzzled on how the
> implementation was designed.
>
> Let say I have this object :
>
> var baseObj = Class.create({
>   initialize: function() {
>     this.foo = function() { alert( "Hello world!" ); };
>   }
> });
>
> And this child object extending baseObj :
>
> var childObj1 = Class.create(baseObj, {
>   initialize: function() {
>     this.bar = function() { alert( "bleh" ); };
>   }
> });
>
>
> In this implementation, the method childObj1.foo(); is not a
> function... as it is a "private" member in the base class.
>
> If I do this :
>
> var childObj2 = Class.create();
> Class.inherit(childObj2, baseObj);    // even if I add a third
> parameter called "base"
>
> Then Prototype causes an error when executing "new childObj2();"
>
>
> Now, this is the piece of code that I was using prior to Prototype
> 1.6 :
>
> /**
> * Inheritance support
> *
> * Source :
> http://www.someelement.com/2007/03/multiple-inheritance-with-prototypejs.html
> *
> * Usage (simple) :
> *
> *    var Class1 = Class.create();
> *     ....
> *    var Class2 = Class.create();
> *    Object.inherit(Class2, Class1);
> *    Object.extend(Class2, {
> *      initialize: function() {
> *        this.base();
> *        ....
> *      }
> *    } );
> *
> * Usage (multiple) :
> *
> *    var Class3 = Class.create();
> *    Object.inherit(Class3, Class1, "baseClass1"); // baseClass1 =
> constructeur Class1
> *    Object.inherit(Class3, Class2, "baseClass2"); // baseClass2 =
> constructeur Class2
> *    Object.extend(Class3, {
> *      initialize: function() {
> *        this.baseClass1();
> *        this.baseClass2();
> *        ...
> *      }
> *    } );
> *
> */
> Object.inherit = function(subClass, baseClass, baseFuncName) {
>   function inheritance() {}
>   inheritance.prototype = baseClass.prototype;
>   Object.extend(subClass.prototype, new inheritance());
>   subClass.prototype.constructor = subClass;
>   if (!baseFuncName || baseFuncName == "")
>       baseFuncName = "base";
>   subClass.prototype[baseFuncName] = baseClass.prototype.initialize;
> };
>
> Which works great and can support multi inheritances.
>
> What are your thoughts on this ? Thanks.
>
>
> >
>


-- 
Ryan Gahl
Manager, Senior Software Engineer
Nth Penguin, LLC
http://www.nthpenguin.com
--
Architect
WebWidgetry.com / MashupStudio.com
Future Home of the World's First Complete Web Platform
--
Inquire: 1-262-951-6727
Blog: http://www.someElement.com
LinkedIn Profile: http://www.linkedin.com/in/ryangahl

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

Reply via email to