Assuming
function( arg1, arg2 )
, is it true thatarg1
will always evaluate beforearg2
(unlike traditional C)?Is there a way to create a function where arguments are not evaluated immediately, but only on demand? For instance, in
if( cond1 || cond2 )
,cond2
is evaluated only ifcond1
is false. Is it feasible to build a customif
-like function for this purpose?
For example, could a function similar to oracle's nvl( arg1, arg2, ... )
be devised to return the first non-null argument by lazily evaluating them? In typical function calls, all arguments are evaluated prior to executing the function body.