2 ms·
Stack/RPN languages are nice because they are easy to evaluate left to right, because you collect the arguments before you call the function. The stack is reduc
by lupire 5y ago
Stack/RPN languages are nice because they are easy to evaluate left to right, because you collect the arguments before you call the function. The stack is reduced as soon as possible, so max execution stack size is equal to the essential complexity of the calculus, for eager-evaluation languages.
"Traditional" Verb-Object order is tricky because you have to save the whole stack of functions before you can start reducing anything. But it's nice if you have partial/lazy evaluation and might discard argument/function calls without evaluating them.
For human UI, it's trivial to view/edit a program displayed in reverse, and add some redundant parentheses, for an applicative syntax, if you like.
- agumonkey 5y agoTo me stack language helped my brain forget about intermediate couplings, where in imperative language you have to imagine and manage data structures with operation around. When all you have is a stack, it's one variable less to worry about, you focus your energy on primitive ops.
- potiuper 5y agoVerb-Object order is not traditional as English is SVO, and Latin by "tradition" puts it at the end; nor does the whole stack of functions have to be saved before reduction can start see the sum or product operators or "verbs".
- lupire 5y agoEnglish instructions (programs) are Verb-Object with no Subject.
- potiuper 5y agoEnglish commands are still SVO, but the subject may be omitted when it is able to be inferred. Some verbs do not allow inference, i.e. fetch or get. "Get water" may mean "[you] get [me or us] water", or it could mean you get yourself water. The subject is also not able to be parsed as a subject by putting it [the subject] as the first word of the object as "[you] get 'you' water" would mean the command to get water for yourself instead of "you get [me or us] water". Additionally, the uniform function call syntax does not apply to English: "Get(Water,[context])" is not the same as "Water.Get([context])", which is even more ambiguous that could mean "Get water" - see above - or that the water absorbed something like "Water get [it/salt/fire]". Also, to clarify Latin by "tradition" puts the verb at the end of the sentence.