Re: new

Mon, 17 Oct 2011 03:07:14 -0700


Regards
--
Irakli Gozalishvili
Web: http://www.jeditoolkit.com/
Address: 29 Rue Saint-Georges, 75009 Paris, France (http://goo.gl/maps/3CHu)


On Monday, 2011-10-17 at 11:16 , Jake Verbaten wrote:

> I do the same with
> Object.prototype.new = function () { 
>   var o = Object.create(this);
>   o.constructor && o.constructor.apply(o, arguments);
>   return o;
>  } 
> However rather then calling proto.new(); I would like var o = new proto(); 
> 
> 


May I ask why (less syntax in language is better no) ?
 
> and o instanceof proto to work
> 
> 


You have proto.isPrototypeOf(o) instead.
  
> 
> > On Oct 17, 2011 9:17 AM, "Irakli Gozalishvili" <[email protected] 
> > (mailto:[email protected])> wrote:
> > 
> > I think we should just forget about new keyword, prototype property all 
> > togather and move towards something more simple: 
> >  var proto = {   method: function() { },
> >   new: function() {
> >     var self = Object.create(this);
> >     this.initialize.apply(self, arguments);
> >     return self;
> >   },
> >   initialize: function(someValue) {
> >     this.things = someValue
> >   }
> > }
> > 
> > var o = proto.new(someValue);
> > 
> > Of course with a help of library that would not require as much 
> > boilerplate: https://github.com/Gozala/selfish  
> > 
> > 
> > Regards
> > --
> > Irakli Gozalishvili
> > Web: http://www.jeditoolkit.com/
> > Address: 29 Rue Saint-Georges, 75009 Paris, France (http://goo.gl/maps/3CHu)
> > 
> > On Tuesday, 2011-10-11 at 20:53 , Jake Verbaten wrote:
> > > > > is there any kind of proposal for syntax that is like : > > var proto 
> > > > > = { >   method: function(...
> > > _______________________________________________
> > > es-discuss mailing list
> > > [email protected] (mailto:[email protected])
> > > https://mail.mozilla.org/listinfo/es-discuss
> > 

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

Reply via email to