3 ms·
The link to Lindsey Kuper's post https://decomposition.al/blog/2017/07/30/what-do-people-mean-when-they-say-transpiler/ https://decomposition.al/blog/2017/07/30
by kragen 1y ago
The link to Lindsey Kuper's post https://decomposition.al/blog/2017/07/30/what-do-people-mean-when-they-say-transpiler/ https://decomposition.al/blog/2017/07/30/what-do-people-mean... is great!
I think the note about generators may be a good definition for when one language is "more powerful" than another; at least it's a good heuristic:
> The input and output languages have the syntax of JavaScript but the fact that compiling one feature [generators] requires a whole program transformation gives away the fact that these are not the same language. If we’re to get beyond the vagaries of syntax and actually talk about what the expressive power of languages is, we need to talk about semantics.
If a given program change is local in language X but global in language Y, that is a way in which language X has more expressive power.
This is kind of fuzzy because you can virtually always avoid this by implementing an interpreter, or its moral equivalent, for language X in language Y, and writing your system in that DSL (embedded or otherwise), rather than directly in language Y. Then, that anything that would be a local change in language X is still a local change. But this sort of requires knowing ahead of time that you're going to want to make that kind of change.
Sadly https://people.csail.mit.edu/files/pubs/stopify-pldi18.pdf https://people.csail.mit.edu/files/pubs/stopify-pldi18.pdf is 403. But possibly https://people.csail.mit.edu/rachit/files/pubs/stopify-pldi18.pdf https://people.csail.mit.edu/rachit/files/pubs/stopify-pldi1... is the right link.
- JoBrad 1y agoThanks for the last link! At first read, the regeneration code is nuts: using a switch to assign a value, then comparing hard coded values. I only used generator functions in TS after they were supported in JS, so I’m going to step through that, just to understand it more.
- kragen 1y agoYeah, I mean, you either kind of have to do something like protothreads, or break apart the function into fragments at the yield points, converting it to explicit continuation-passing style.