What is the order of evaluations of parameters inside the function? -
having foo(bar1(), bar2())
can sure in sml evaluate bar1()
first , after bar2()
?
yes. strictly speaking have function applied tuple. fields of tuple evaluated left right bar1() evaluated before bar2(). see "the definition of standard ml (revised)" milner, tofte, harper , macqueen page 41.
note if foo expression have side-effects or raise exception evaluated before argument , therefore before either bar1() or bar2(). particularly has implications curried applications.
foo (bar1()) (bar2())
will evaluate first bar1() foo(bar1value) before evaluating bar2().
Comments
Post a Comment