>
> Should `extend' copy all the properties? Only the "own" properties? I feel
> `own' properties make more sense.
>

I agree "own" makes more sense, we also want to specify whether we want to
extend "enumerable" properties. Your example does not.

>
>
> - Defining new objects that extends on the [[Prototype]], which is
> basically Object.create followed by copying the properties of one or more
> objects over to the new instance. (Object.clone? Object.inherit? I never
> felt `extend' quite says it all)
>
> Object.prototype.clone(Object parent, Object mixins...) → Object
> (Object.extend.apply(Object.**create(parent), mixins))
>

I've been referring to this method as
Object.make<https://github.com/Raynos/pd/blob/master/src/pd.js#L120>
it's
defiantly a useful method, however I don't think "clone", "inherit" or
"make" are correct names for it. "clone" is probably the most suitable
name, especially if it's on Object.prototype


> var foo = Base <| {
> #constant: 1, // or const
> @private_stuff: bar, // or private
> method1() { },
> method2() { }
> get stuff() { }
> }
>
> Except I'm not sure the @private could be made to work without creating
> confusing semantics around it, so object literals would still be one step
> behind.


As far as I understand "@private_stuff" would desugar into a name object
only available in scope of the object literal.

var o = {
  @private_stuff: bar;
  method1() { }
}

var o = (function () {
  var private_stuff = name.create();
  var ret = {
    method1() { }
  }
  ret[private_stuff] = bar;
})();

I personally don't find that confusing.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to