On Jun 25, 7:50 am, Andrew Dupont <[EMAIL PROTECTED]> wrote:
> On Jun 24, 7:48 pm, Tobie Langel <[EMAIL PROTECTED]> wrote:
>
> > I personally prefer the following syntax:
>
> > var Animal = new Class({
> > ...
>
> > });
>
> > var Cat = new Class(Animal, {
> > ...
>
> > });
>
> I abhor this syntax. I wish I could put it any more mildly.
>
> In languages with class-based inheritance, class creation and class
> instantiation are two separate concepts. Defining a class is done
> within a control structure. I can think of nothing more confusing than
> instantiating Class to create your class, then instantiating your
> class to create an instance of the class you just instantiated with
> Class.
Yes, but JavaScript is different. The class is really a (function)
object in JavaScript - it isn't common, but this makes JavaScript a
very flexible language. We can't compare JavaScript in everything to
other OO languages.
This approach (using new) is very interesting and innovative for
me :-)
But other solutions are pretty too :-)
> > Also, I think that this.sup or this.$super would be safer than using
> > this.parent, which, in the realm of DOM scripting might be used pretty
> > often inside classes already.
>
> "this.$super" is fine with me
"parent" is very popular name for an attribute. Please don't use it.
The most natural, IMHO, seems to treat all new attributes and methods
added by prototype as "magic" and prefix them with anything (as
prototype uses the dollar sign ($) frequently for added stuff, it
would be most natural choice again).
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---