Hacker Newsnew | comments | show | ask | jobs | submit login

And when you look at the Ember source this is basically what reopen is doing.

But (!) writing

  C.reopen({
    foo: function() { /* ... */ },
    bar: function() { /* ... */ }
  })
instead of

  /*window.*/merge(C.prototype, {
    foo: function() { /* ... */ },
    bar: function() { /* ... */ }
  })
makes for easier reading, which is worth a lot in my opinion.

It's the same as Cocoa providing -[NSMutableArray removeLastObject] in addition to -[NSMutableArray removeObjectAtIndex:] and -[NSMutableArray length]

Sure you can express one with the other, but readability matters.




Applications are open for YC Winter 2016

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: