Ah right, and also, the Scheme stack being an extensible array allocated contiguously - does the Gambit code have logics that clean it up as you go along, or is all that done by the JS GC too?

By extensible, do you mean variable-size through use of JS' .push() / .pop() , or something else?

Best regards, Mikael

Scheme objects are mapped to JS objects.  So a pair is an instance of the “class” Gambit_Pair, and a vector is an instance of the class Gambit_Vector.  Scheme closures are JS closures.  A Scheme continuation is a chain of frames (each frame is a JS array).  So everything is garbage collectible by the JS GC.

There is a bit of fanciness in how the continuations are created.  The Scheme stack is an extensible array and stack frames are allocated in this array contiguously.  When a continuation is captured the stack is emptied and each frame becomes an independent JS array.

Aha. And then, when one stack frame (JS  array) refers to another stack frame (JS array), then this is done by the means of an actual object reference?

E.g.

var frame1 = [value, value ...... ];

var frame2 [value, ........ frame1, ...];

?

Marc