Hmmmm, ok, reading over all the discussion, how about using Class for
everything and kind of "yield" the new class around? Like so:

Class.extending(ParentClass).including(Enumerable,
Comparable).create({
  initialize: function() { ... },
  ...
}).aliasing({
  anAlias: aliased,
  ...
});

All of extending, including and create create (sic) a class and pass
it to the next one, which actually modifies it to comply with what the
method does, so the order is not fixed (nor any of them would be
actually required except for 'extending' or 'create' so you get an
initialize method).

It gives you the power of doing

Class.aliasing({ ... }).create({
  ....
});

If you think that the aliases are more important than the methods (or
you can call including below, if you don't want to clutter the
definition with the inclusion of Enumerable since the class is, for
example, a StuffList, and it's pretty obvious it's enumerable...).

Pros:
- Nice API (IMHO, of course) :P
- Backwards compatible
- No HORRIBLY-UGLY-VOMIT-PROVOKING uppercased keywords (Extend,
Include, ClassMethods) ;)
- No name clashes

Cons:
- Probably hard to implement? Haven't thought about it, this kinda
just occurred to me while I read your posts :)
- You fill this in...

===

About how to call the "super" method, I'd go with sup. It's easy, it's
short, it reminds of 'super' (although as has been cited, php people
are used to parent over sup, but still). The only possible problem is
that it could clash with something, but I'd include it "before"
anything, so if you declare a sup on your class you overwrite the
special one.

===

One more thing, about the use of 'new Class(...)'. I've used the
'klass = Class.new(Parent)' pattern in ruby as a way to define a
dynamic, anonymous class. I don't see new Class({...}) *sooo* distant,
considering than in javascript classes *are* dynamic and anonymous.
However, I see Andrew's point about how it might be confusing... but I
still like it :)

===

Regards,
-foca


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