ίϯύΠϧ: ؔఆٛ
• ͕ؔωετͨ͠߹
• ؔ͝ͱʹΫϥε͕ੜ͞ΕΔ
• Fun$1ͷੜ࣌ɺFun$0ͷҾͱͯ͠͞ΕͨxΛίϯετϥΫλʹ͍ͯ͠Δ
• getLocal(1, 0) Ͱ depth = 1, index = 0 ͷ(͜ͷ߹Fun$1.local)Λऔಘ
• indexʹ͍ͭͯޙड़(let recͰ༻)
fun x: int =>
fun y: int =>
x + y
class Fun$0(parent: Fun, local: Object)
extends Fun(parent, local) {
int depth = 0
Object app(x: Object) =
new Fun$1(this, x)
}
clas Fun$1(...) extends Fun(...) {
int depth = 1
Object app(y: Object) = {
val x = getLocal(1, 0)
(int)x + (int)y
}
}