programming languages - Shallow & Deep Binding - What would this program print? -


I'm not sure how to do this ...

  function f1 () { Var x = 10; Function F2 (fx) {var x; X = 6; Fx (); }; Function F3 () {Print X; }; F2 (f3); };   

For the following two binding methods, what will the program print? A) shallow binding B) Deep binding

Thanks for the help!

Deep / shallow binding only makes sense when a procedure passes as a logic of a function can be done.

  • Deep binding binds the environment when any process is passed logic.
  • Shallow bondage binds the environment when a process is actually called.

    Deep binding.

    Here f3 () is f1 () / em> and x of 10 which is the local variable of f1 () .

    shallow binding

    f3 () is called in f2 () and hence the environment of f2 () gets and prints the value of x 6 which is local f2 ()

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -