After getting rake to work ...

1) Makes sense: Yes, Surprised: No, seems like the next logical step,  
Suggestion: see below

2) this.parent() .. the name "parent" is not tooo obvious tho, but i  
couldn't think of a better one either. On first sight i thought you  
mean this.parent() would refer to parent Object and not parent method  
of the same name.

3) I couldn't find the magic properties you wrote about, but i would  
like to have them and think that the amount of magic is just about  
right.

While writing this mail and going on about your questions, i had a  
hard time to find something i could suggest.. i think the  
implementation is perfect so far

Maybe it would be great to have a parent property to access all - 
original- superclass methods and properties:

   var TomCat = Class.extend(Cat, {
        initialize: function() { this.name = "Tom"; },
        hunt: function() { return this.say('hunting Jerry'); }
   });
   var JimCat = Class.extend(TomCat, { // note: Sub of TomCat
        initialize: function() { this.name = "Jim"; },
        hunt: function() { return this.say('hunting Tom'); }
   });

  t = new TomCat();
  j = new JimCat();

  t.hunt() // -> Tom: hunting Jerry
  j.hunt() // -> Jim: hunting Tom
  j.parent.hunt() // -> Tom: hunting Jerry

j.parent should contain the superclass as it is. It would allow more  
flexibility, i think, while calling "return this.parent()" in  
JimCat::hunt() stays as it is and results in "Jim: hunting Jerry".

What do you think about it?

Best,
Kjell


Am 23.06.2007 um 22:02 schrieb Andrew Dupont:

>
> We've been working on a more robust class-based inheritance model,
> fashioned after Dean Edwards's Base and others like it. There's an
> inheritance branch in the SVN repository that shows our latest
> efforts.
>
> We've had some lively internal discussions about syntax. I figured I'd
> hold my finger to the wind and see how the list feels about some of
> these issues.
>
> First, go to <http://dev.rubyonrails.org/browser/spinoffs/prototype/
> branches/inheritance/test/unit/base.html> and take a look at the
> handful of unit tests we've written for inheritance. The fixtures
> start at line 60 (Animal, Cat, Mouse) and the tests start at line 315.
>
> Next, consider these questions:
>
>   1. Does the current API make sense? Was there anything about it that
> surprised you? Anything you'd add or remove?
>   2. Does "this.parent()" make sense as a way of calling the
> superclass's method? (We can't use the word "super" because it's
> reserved in JavaScript).
>   3. Right now there are a few "magic" properties in class instances:
> "superclass," "subclasses," and "parent." Is this too much magic? Not
> enough magic? Do you think these are likely enough to conflict with
> existing properties of a class that it's worth namespacing them
> somehow? ($superclass, $subclasses, $parent, etc.)
>
> Feel free to make feature requests or ask other questions. Kudos to
> Alex Arnell's inheritance scheme <http://twologic.com/projects/
> inheritance/> for getting all of this started.
>
> Cheers,
> Andrew
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" 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/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to