othree / es.next.syntax.vim

ES.Next syntax for Vim
MIT License
125 stars 7 forks source link

es7 bind syntax #1

Closed vm closed 8 years ago

vm commented 8 years ago

Hey man!

Thanks for an awesome repo. Was wondering if this is currently supported?

class Hello extends React.Component {
  constructor(props) {
    super(props)
  }

  hello() {
    return "hello, " + this.props.name;
  }

  render() {
    <div>{::hello()}</div>
  }
}

Basically, that ::hello() is the same as hello().bind(this).

RaitoBezarius commented 8 years ago

While testing, it seems like no. I get a red highlighting on the second :. Would love to see this working neverthless. So :+1: !

othree commented 8 years ago

NO~

Any reference of this new spec?

RaitoBezarius commented 8 years ago

I could not find a spec, sorry! But there is a lot of discussion around this: http://blog.jeremyfairbank.com/javascript/javascript-es7-function-bind-syntax/ And some examples showing how to use.

And since Babel implemented it, I think that it is on its way.

othree commented 8 years ago

https://github.com/tc39/tc39-notes/blob/master/es6/2015-03/mar-25.md#6vi-function-bind-and-private-fields-redux-kevin-smith https://github.com/zenparsing/es-function-bind http://babeljs.io/docs/plugins/transform-function-bind/

RaitoBezarius commented 8 years ago

Awesome! Thanks a lot @othree !

vm commented 8 years ago

You're the best!