Generator access by interactor support
neviaumi opened this issue · 1 comments
neviaumi commented
I attempt use ES6 new feature which is generator function (yield) and read it by for...loop
In javascript i can simple write below :
function* hello(){
var i = 10;
for (var j =0 ;j<i;j++){
yield j
}
}
for(var i of hello()){
console.log(i)
}
In coffeescript:
hello = ()->
for i in [0..10]
yield i
return
for i of hello()->
console.log i
coffee script nothing output.... this is due to compiled js still using for...in instead of for...of, currently i just using embed javascript to solve this problem , could you please fix it ?
sukima commented
@davidNHK CoffeeScript doesn't support ES6 syntax. Instead you have to wrap some of the es6 specific code in back ticks. However, in your example I don't even think back ticks are possible. You would be better of writing those es6 specific functions in JavaScript and referencing them from CoffeeScript later on.