nineties / amber

A Language for High-Level Programming with Self-Extension
http://nineties.github.com/amber
Other
341 stars 10 forks source link

[BUG] Inconsistency: shift/reset delimited continuation #337

Open nineties opened 9 years ago

nineties commented 9 years ago
amber:1> reset {
amber:1~        s := 0
amber:1~        for i in 1..3
amber:1~                s += (shift c -> c)
amber:1~        s
amber:1~ }
=> <#Function(Cont)>
amber:2> $(1)
=> <#Function(Cont)>
amber:3> $(2)
=> <#Function(Cont)>
amber:4> $(3)
=> 6
amber:5> $1(1)(2)(3)
=> 3
nineties commented 9 years ago

Following experiment shows that return values of shift ... are 1 all the time in line 5. Calculation of base-pointer might be wrong.

amber:1> reset {
amber:1~        s := 0
amber:1~        for i in 1..3
amber:1~                s += (shift c -> c)
amber:1~        s
amber:1~ }
=> <#Function(Cont)>
amber:2> $(1)
=> <#Function(Cont)>
amber:3> $(3)
=> <#Function(Cont)>
amber:4> $(5)
=> 9
amber:5> $1(1)(3)(5)
=> 3