Borrowed the “return expr if(cond)” syntax from ruby
Implemented Tail call optimization which optimizes away recursion on tail calls
Example:
Before:
str count(int amount) {
return "Done!" if amount == 1;
return count(amount - 1);
}
After:
str count(int amount) {
int tco@argument@amount = amount;
while (true) {
if (tco@argument@amount == 1) return "Done !";
tco@argument@amount = tco@argument@amount - 1;
}
}
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.