Talk:Parsing/RPN to infix conversion: Difference between revisions

→‎Examples Incorrect: Leave commutativity out of this!
(→‎Examples Incorrect: Leave commutativity out of this!)
Line 16:
:::: By adding the extra example in a table other examples could be added easily. Although for output, perhaps suppressing the detail for all but one case would be appropriate. --[[User:Dgamey|Dgamey]] 18:19, 17 December 2011 (UTC)
::: Sorry I thought what you were talking about is if an operator is commutative? --[[User:Dgamey|Dgamey]] 18:19, 17 December 2011 (UTC)
:::: The RPN code shouldn't try to use commutativity, as that causes problems in situations where there are side-effects. (OK, not in ''this'' example, but in general.) While a few languages allow optimizers to use it (notably [[C]] and [[C++]]), most don't because it causes much confusion; overall, language designers have found it better to be more predictable than that (where side-effects are present at all, of course). –[[User:Dkf|Donal Fellows]] 18:59, 17 December 2011 (UTC)
: Tcl version is now fixed (it would have helped if the original example had been sensitive to such things, but there you go). –[[User:Dkf|Donal Fellows]] 18:59, 17 December 2011 (UTC)
 
== New Input examples ==
Anonymous user