Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transpiler #7

Open
blakelapierre opened this issue Dec 22, 2014 · 7 comments
Open

Transpiler #7

blakelapierre opened this issue Dec 22, 2014 · 7 comments

Comments

@blakelapierre
Copy link

Is there a transpiler for this yet (preferably for Traceur)?

@mnieper
Copy link

mnieper commented Feb 9, 2015

I've been working on it. The for-on loop is already implemented in the master branch of Traceur behind the --for-on experimental flag.

Please try it out.

The async generators themselves will follow soon.

@blakelapierre
Copy link
Author

I'll try it out soon.

I've been using 6to5 lately as it has better feature coverage at the moment and integrates a bit better with my tooling. Any chance of getting it in over there?

@mnieper
Copy link

mnieper commented Feb 9, 2015

I have been doing it in my spare time, so I'd rather like to implement more features to one tool (in this case, Traceur) than to learn a new transpiler's internals and implement the same things there. However, maybe there is another volunteer to do this.

In any case, the last time I tried out 6to5 I wasn't convinced. They promise more than what they can fulfiill. For example, 6to5 promises to have proper tail call support. But apparently they can only do it for self-recursive functions (which is definitely a very boring use case for PTCs). On the other hand, this code

function f(n, m) {
  if (n === 0) {
    return m;
  }
  return g(n - 1, n * m); 
}

function g(a, b) {
  return f(a, b);
}

is left untouched by the transpiler.

P.S.: Has been addressed here: http://6to5.org/docs/learn-es6/#tail-calls

@blakelapierre
Copy link
Author

It's very understandable to implement the features in a single tool. I've briefly looked at Traceur's code and haven't looked at 6to5's at all. I've been primarily focused on applications and tools at the moment, and have mostly been concerned with just getting something that "works". Which, by far, the most important to me has been the syntax improvements.

I was working on a generator library both as an exercise and for use in some applications and tried (hoped!) to combine async functions and generators, which is how I found this project.

I have some experience in compilers so I may soon try to get into some of the internals and see what's going on and contribute where needed, if I can.

@mnieper
Copy link

mnieper commented Feb 9, 2015

@mnieper
Copy link

mnieper commented Feb 11, 2015

My work has now been merged into the master branch of Traceur. It now includes async generators as well as the for-on loop. Examples can be found under test/feature/AsyncGenerators. Documentation will follow soon.

@blakelapierre
Copy link
Author

Very cool, I'll have to find the code I was working on and try it out soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants