I am working on a proposal that I intend to bring to the next TC39 meeting. The (very much in need of updating) gist for my proposal is here:
https://gist.github.com/jeffmo/054df782c05639da2adb

(Note that this gist is from July of last year, which was before we eliminated @@create and imposed the new super() allocation semantics for derived classes -- so it needs to be updated to reflect those two changes. Hopefully I can find some time to update it in the next week or two)

-Jeff

On 2/10/15 7:47 AM, Benjamin (Inglor) Gruenbaum wrote:
Looking at the syntax from here:

http://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html#es7-property-initializers


      ES7+ Property Initializers

Wait, assigning to properties seems like a very imperative way of defining classes! You're right, however, we designed it this way because it's idiomatic. We fully expect a more declarative syntax for property initialization to arrive in future version of JavaScript. It might look something like this:

// Future VersionexportclassCounterextendsReact.Component{staticpropTypes={initialCount:React.PropTypes.number};staticdefaultProps={initialCount:0};state={count:this.props.initialCount};tick(){this.setState({count:this.state.count+1});}render(){return(<divonClick={this.tick.bind(this)}>Clicks:{this.state.count}</div>);}}

Also discussed here:

https://github.com/6to5/6to5/issues/619

Are there any plans to specify this? Are there any proposals being worked on to specify syntax similar to this or alternative syntax addressing this?



_______________________________________________
es-discuss mailing list
[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