Thanks guys for the input!

@Jake:
It's evil to extend Object.prototype with an enumerable property.
here "_prototype_" is non-configurable because the logic here depends
on it. If you choose to use this then you'd want it to be non-
configurable.
But perhaps you're right and I could add "configurable: true", seems
like a good idea.

The "_asDescriptor" function is private and quite straight-forward.
The use of the letters e, p &r is a physical joke, and I didn't think
that following a single-line function would be too hard to follow.
Anyhow, I guess I'll change those to something more meaningful.

I'm sorry that you see the supr function as magic, cause actually it
follows the straight forward logic of getting an overridden property
in a prototype chain:
You find the object in the chain that actually defines this property
and then get this property again from its parent.
Since JS don't protect you from possible errors you need to go through
some hoops.

What are Object.make & Object.createSimple?
And yes, Create is very thin and light, that was the objective here.

@Alexander:
As I mentioned in the docs, if you name each method you're using supr
inside and not in strict mode then you can loose the "name" param.

Personally I don't like Resig's this._super because I find it very
obtrusive, it bloats your code, and frankly it uses magic like using
regex on the function.toString().

If you consider using a function's name inside it as breaking the DRY
principle then I guess that's your opinion. In python, you call a
super function like this:
class C(B):
    def method(self, arg):
        super(C, self).method(arg)

You could say I took some inspiration from that.
Besides that, putting a name of a different property allows you to
call a different overridden property, which is not RY at all.

Thanks!
~Y


On Oct 24, 1:01 pm, "Fyodorov "bga" Alexander"
<[email protected]> wrote:
> ydaniv:
>
> > Hi,
>
> > I saw some discussions about OO & inheritance in JS so thought I might
> > share a small Gist I've contrived:
>
> >https://gist.github.com/1074335
>
> > It's ES5 only and implements a simple wrap for the Object.create
> > mechanism and a "super" property getter in a more unobtrusive way.
>
> > It's OS and will appreciate any feedback.
>
> > Thanks,
> > ~Y
>
> this._super() is better then your method because you force me
> duplicate method name, its not DRY

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to