dimanche 23 mars 2014

Are dynamic binding and shallow binding the exact same thing?


Vote count:

0




In both dynamic and shallow, when functions are invoked, can't you simply say that the new reference environment is simply the current environment linked to the new one?


Consider this code with deep+dynamic binding AND shallow+static:



var a = 4

function x() {
print a
}

function y(p) {
a = 0
x();
p();
}

y(x)


Regardless as to if deep or shallow binding is used, wont the output be 00? And if this were static+shallow then wouldn't this be silly, because then functions passed by reference would behave dynamically and all others wouldn't, which would be inconsistent?



asked 50 secs ago

Macmee

1,148





Aucun commentaire:

Enregistrer un commentaire