副程式名當作副程式的參數,關於被傳入的副程式執行時的參考環境(Referenceenvironment),以下那一方法最適合Dynamicscoping的程式語言?
(A)Shallowbinding
(B)Deepbinding
(C)Adhocbinding
(D)以上皆非
答案:登入後查看
統計: A(71), B(44), C(40), D(14), E(0) #28694
統計: A(71), B(44), C(40), D(14), E(0) #28694
詳解 (共 2 筆)
#1297215
Dynamic scoping從 Call Stack 找 Scope
Static Scoping從 Definition 找 Scope
http://pjack1981.blogspot.tw/2013/06/static-vs-dynamic-scoping.html
Shallow淺的
ShallowBinding gives good performance when looking up variables, but makes the implementation of DynamicClosures difficult. MacLisp, for example, only solved the "downward funarg" problem, and not the "upward funarg" problem.
2
1
#3316234
淺繫結(Shallow Binding)
為副程式變數取值的實作方式,指副程式中若無定義變數,
則會參考執行副程式的敘述當時環境的變數值來取值。
深繫結(Deep Binding)
為副程式變數取值的實作方式,指副程式中若無定義變數,
則會參考副程式定義時結構的上層來取變數值。
特設繫結(Ad-hoc Binding)
為副程式變數取值的實作方式,指副程式中若無定義變數,
則會參考呼叫副程式時的環境來取變數值。
0
0