Re: new

Tue, 11 Oct 2011 16:03:22 -0700

On Oct 11, 2011, at 18:51, Jake Verbaten wrote:
> On Oct 11, 2011 11:46 PM, "Kevin Reid" <[email protected]> wrote:
>> On Oct 11, 2011, at 18:29, Jake Verbaten wrote:
>>> Point.zero = function () {
>>> return (new Point)...
>> I agree with "things should be just methods", but this particular pattern
>> doesn't work for always-frozen types.

> So basically your saying that the only function that can alter an object
> before its frozen is the constructor, thats why we need multiple
> constructors?
> 
> You'll have to subclass with another constructor or come up with syntax for
> multiple constructors.

Well, in JavaScript you can always Object.create(Point.prototype, ...).

In Java, for example, the ability to have multiple constructors can be very 
convenient for that type of use case; but it always can be replaced with 
factory methods and a private constructor with more parameters.

Actually, my original remark may be off-base anyway; I haven't followed the 
discussion well enough. If the ".{" syntax returns a new object rather than 
mutating one, then I was confused.


-- 
Kevin Reid                                  <http://switchb.org/kpreid/>

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to