Are parameters replaced by the callers arguments before function execution even if they havent been evaluated, true in all cases?

16 views Asked by At

Are parameters replaced with their respective arguments before function execution even if they havent been evaluated (I.E. irrespective of whether lazy or eager evaluation is used),true in all cases.

I want to understand whether we can generalise the statement:

Before a function is executed (irrespective of argument evaluation), the parameters are "assigned" to the arguments in the function call.

e.g. f(x,y)
    x +=1
    y +=1
    return x+y;

I call f(1,2):

  1. 1 and 2 is assigned to x and y
  2. then the rest is executed

I call f(2*3,5*6):

  1. In eager evaluation 6 and 30 is assigned
  2. In lazy evaluation 2*3 and 5*6 is assigned?

Please could you clarify, thank you!

0

There are 0 answers