Garrett Smith dhtmlkitchen at gmail.com
Sun Oct 21 22:56:22 PDT 2007

On 10/21/07, Kris Zyp <kriszyp at xucia.com> wrote:
> >> http://javascript.crockford.com/prototypal.html
> It is the act of creating a object that inherits from/delegates to the
> provided object. Peter is suggesting sugar for one of the important
> mechanisms in a prototypal language. I believe the "copy" semantic is used
> in Self. "clone" is bit misleading (well, I think "copy" is too). With
> classes, we call it "subclassing". We could call it "subobject" :). Douglas
> calls it "begetObjet" (nice), I personally think it is very valuable
> construct and I like what it encourages, but on the otherhand it is so
> easy/compact to create (about 4 lines of code), and it doesn't seem to be
> the direction ES4 is headed, so it's omission seems reasonable.
function beget(o) {
        function F() {}
        F.prototype = o;
        return new F();

var x = {
    items : [1,2,3]

var y = beget(x);
y.items.reverse(); // reverse my y items.

x.items[0]; // What is it?

The point I made earlier about mutable objects addresses this very issue.

It's attractive, but easily breakable.

> > YAHOO.mst.app.code = (function(){
> > // 1100+ lines...
> >
> I don't think this doesn't have anything to do with the topic.
It's little off-topic. It can cause problems in real-world programming
was the point I was trying to make. Looking at Doug's side made me
remember that code and the (long, excruciating) time I spent, often @
the office until 8 or 10 on a Friday. I'm getting off topic again...


> Kris

Programming is a collaborative art.

More information about the Es4-discuss mailing list