3 ms·
> your code only works because a compiler optimization makes it work. If a different compiler executed your code exactly as written it would crash. But it's co
by mikebenfield 9y ago
> your code only works because a compiler optimization makes it work. If a different compiler executed your code exactly as written it would crash.
But it's completely arbitrary that you consider this "a compiler optimization" as opposed to "the way the language behaves." The languages you're used to work the way you describe: if the stars are aligned, a particular compiler may do TCO as an extra optimization.
But there is absolutely no reason it has to be this way. It is perfectly possible for a language standard to mandate that TCO must happen and to specify in an easily understood way when it must happen. As Scheme did over 40 years ago.