Object literal methods and generator
# Brendan Eich (14 years ago)
Yes, we talked about * before the name (after the imaginary 'function' keyword), see
Yes, we talked about * before the name (after the imaginary 'function' keyword), see https://mail.mozilla.org/pipermail/es-discuss/2011-October/017314.html /be > Herby Vojčík <mailto:herby at mailbox.sk> > January 13, 2012 2:15 AM > Hello! > > In object literal, one can define method by > method (args) { > body > } > which is nice shortcut for 'method: function (args) { body },' with > added value of method being non-enumerable. But there is no shortcut > for 'gen: function* (args) { body },'. > > What about extending the object literal notation with > *method (args) { > body > } > to define a generator method? > > Herby > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120113/5667a355/attachment-0001.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: postbox-contact.jpg Type: image/jpeg Size: 1080 bytes Desc: not available URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120113/5667a355/attachment-0001.jpg>
Hello!
In object literal, one can define method by method (args) { body } which is nice shortcut for 'method: function (args) { body },' with added value of method being non-enumerable. But there is no shortcut for 'gen: function* (args) { body },'.
What about extending the object literal notation with *method (args) { body } to define a generator method?