3 ms·
"A terminator is required, multiple terminators (ie, redundancy) are not." Food for thought and discussion, rather than a "correction": Terminators are not req
by jerf 10y ago
"A terminator is required, multiple terminators (ie, redundancy) are not."
Food for thought and discussion, rather than a "correction": Terminators are not required in a language. See the concatenative languages like Forth or Factor, in which
z = func1(x, y);
func2(1 + 2 + 3, z);
comes out looking like
1 2 + 3 + x y func1 func2
And, indeed, many people find this a fairly confusing programming style. (For instance, note how the second expression has no "z" variable in it.) Functions tend to become difficult-to-differentiate streams of tokens with few breaks in them. You'll also note that by token count the concatenative approach is smaller (21 non-whitespace tokens in the first if I'm counting this correctly, 9 tokens in the second); that is normal, not a fluke. By using the stack to hold things almost all variable assignments and their usages end up going away. However, despite being a programming paradigm that nearly as old as imperative programming, it has not taken the world by storm.
- saywatnow 10y ago> note how the second expression has no "z" variable in it. A better comparison would be to func2(1 + 2 + 3, func1(x, y));
- WalterBright 10y agoThe parentheses are redundant as well, if the code was reordered. Haskell eliminates the ( ) for function arguments. While Haskellers like this, I find it makes the code very hard to read.
- jerf 10y agoBoth are idiomatic in their own domain. Obviously I'm not trying to token-golf or neither would have 1 + 2 + 3 in it.