spider icon indicating copy to clipboard operation
spider copied to clipboard

ES6 Classes?

Open alongubkin opened this issue 10 years ago • 5 comments

alongubkin avatar Nov 15 '14 10:11 alongubkin

I think it makes sense to be close to ES6. Specially the common features should be consistent.

nmn avatar Nov 18 '14 18:11 nmn

+1. The current class model is somewhat flawed in that it doesn't really use prototypes, so an actual class keyword would be great.

timdp avatar Nov 19 '14 19:11 timdp

@timdp It does use prototypes:

func Snake(name) 
  extends Animal(name) {
  ...
}

Snake.prototype.instanceMethod = func () { 
  super.instanceMethod(); 
};

alongubkin avatar Nov 19 '14 19:11 alongubkin

@alongubkin That's what I thought, but the TimeMachine example on the website doesn't work that way. Also, having to do the whole prototype dance yourself is incredibly tedious, although that's what this issue is about.

timdp avatar Nov 19 '14 19:11 timdp

Spider seems so far is a strict improvement of javascript. It makes sense to keep the good ideas of Javascript. And I would say that classes is a good feature of ES6. That is if we assume Classes of any kind are a good idea. I would be open to removing all class patterns from Spider as well, and never using 'new', prototype or any of that stuff. You know, like Crockford.

nmn avatar Nov 28 '14 18:11 nmn