[General] LK JS OO Architecture

Philip Weaver philmaker at gmail.com
Tue Apr 21 07:55:29 CEST 2009

Javascript is a message-oriented OO system except that it doesn't support
classes per se -
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() {

Person.prototype = {
 initialize : function() {
 sayHello : function() {

var person = new Person();


On Mon, Apr 20, 2009 at 9:26 PM, Owen Densmore <owen at backspaces.net> 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
> General at livelykernel.sunlabs.com
> 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 

More information about the lively-kernel mailing list