Javascript is a message-oriented OO system except that it doesn't support
classes per se -
prototypes<
http://en.wikipedia.org/wiki/Prototype-based_programming>
instead.
The LIvely team added class support with the function "subclass" which is
defined in Base.js. I'm sure the team will answer this completely - I can't
answer the Smalltalk analogy.
TextMorph.subclass('mynamespace.MyTextMorph', {
initialize : function($super) {
$super(new Rectangle(0, 0, 200, 30), 'Some Text');
}
});
For a comparison, this is plain Javascript - and this is the most common way
to create objects to message.
Person = function() {
this.initialize();
};
Person.prototype = {
initialize : function() {
console.log('Person.initialize');
},
sayHello : function() {
console.log('Hello');
}
};
var person = new Person();
person.sayHello();
Phil
On Mon, Apr 20, 2009@9:26 PM, Owen Densmore <
[hidden email]> wrote:
> OK, now for the dumb question of the month: How in the world does LK
> wrestle JS into being a message based, OO system?
>
> I'm reading "Object-Oriented JavaScript" by Stoyan Stefanov and it
> takes me back to the days that Lisp and Scheme declared that they
> simply didn't need OO architectures, they can invent their own so
> easily it was not important. They forgot to mention that they needed
> the rest of the world to agree with which ever system they chose! ..
> few of the alternatives interoperate!
>
> So the book points out about a dozen ways to be OO in JS. I know LK
> uses Prototype. Is that the Answer? Or did LK figure out a sane
> system that fits the Smalltalk messaging model well that isn't in the
> several JS OO patterns?
>
> Whew!
>
> -- Owen
>
>
> _______________________________________________
> General mailing list
>
[hidden email]
>
http://livelykernel.sunlabs.com/mailman/listinfo/general>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://livelykernel.sunlabs.com/pipermail/general/attachments/20090421/3e4e665b/attachment.html