You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proposed in this thread. This would let each parser do a sane job of counting how many real statements are used, instead of getting all crazy with trying to reverse-engineer what was once a meaningful statement from the transpiled output.
The text was updated successfully, but these errors were encountered:
Originally I hadn't considered branches, but I think the most common case is probably an if/else or if/else if/else where the block that contains the most statements is probably the branch doing the work.
Of course, with loops where n is relatively large and you're expecting the common case to be a no-op and the exception being where you do work, that algorithm falls on its head. Also, I have to consider that this is geared a lot towards those who are newer to programming and their code very well might not reflect what my gut says is the common case.
But I think it's still possibly more workable than trying to reverse engineer translated code if you accept a wider margin of error. Anything else that I can think of involves injecting code into the emitted javascript to increment counters.
<thinkingOutLoud>
OTOH, that approach would allow for all languages to be supported if they can be translated to JS, but I suspect there would still be edge cases that are different for each language that would have to be dealt with on a per language basis and then we're back at square 1.
</thinkingOutLoud>
We can just count all unique statements; it's really not important whether they get run or not. The incentives are still there to minimize the amount of code you write.
Proposed in this thread. This would let each parser do a sane job of counting how many real statements are used, instead of getting all crazy with trying to reverse-engineer what was once a meaningful statement from the transpiled output.
The text was updated successfully, but these errors were encountered: