3 ms·
Scheme and Haskell have other primitives that take the place of while and goto. But yes, using more expressive match types or parameters is a good idea. As for
by qwertyuiop924 10y ago
Scheme and Haskell have other primitives that take the place of while and goto.
But yes, using more expressive match types or parameters is a good idea. As for providing the result as an argument, that can be a good pattern, but isn't always practical. Note what I said in my original comment about using your own discretion.
- eru 10y agoThey don't have `other primitives': they have function calls. Most languages have function calls these days.
- qwertyuiop924 10y agoYes, I read LTUI and LTUD. But in most languages, function calls and loops don't have the same semantics. I'll call that a different loop primitive.
- eru 10y agoFor C, this seems to be implementation defined. (At least for C as encountered in the wild, I don't know about C the standard.) Most modern C compilers support tail call optimization. I don't know about `most languages'. Eg I know Java on the JVM doesn't do tail call optimization. Lots of languages probably do not require TCO of their implementations, though.