<div dir="ltr"><div>Aha, awesome.</div><div><br></div><div>For the sake of practical overview on this environment, to get a grasp of what it's like and how it behaves:</div><div><br></div><div><ol><li>What about Gambit's globals, are they JS variable references i.e. within JS' variable namespace, or does G. implement an internal by itself?<br>



<br><div>Is there any overlapping of [global] variable namespaces with JS?</div><div><br></div><div>For instance, refering to a global ABC in the Scheme code, what JS variable would that refer to.<br><br></div></li><li><div>



How would you export a function from Scheme for ordinary JS to be able to call it, by some name?<br><br>Must any particular condition be met for a call from JS to Scm-JS code to be 'safe'?<br><br></div></li><li><div>



To get and set JS-native hashtable values aka JS object properties from Scheme, how do you do that?<br><br>The keys would either be static (e.g. objectvariable.thisstaticname = newvalue;), or dynamic (e.g. var itsvalue = objectvariable[dynamickeyvalue];).<br>



<br></div></li><li><div>Invoking a JS-native function would be just as an ordinary Scheme function i.e. (functionvalue) right ?<br><br></div></li><li>May you be about to implement more sophisticated Scheme functionality / runtime such as (in descending order of usefulness)<br>



<br></li><ol><li>The numeric tower? (at least the basic typehandling for the op and its storage format, someone else could fill in the actual procedures)<br><br></li><li>Ports?<br><br></li><li>Real hashtable? (i.e. implement its own make-tabe + accessors, or, would your take on this partiuclar one be that one would be equally well off using some ordinary JS library for it)<br>



<br></li><li>U8vector?<br><br></li></ol><li>Would there be any native access to JS' language features:<br><br></li><ol><li>object instanation form i.e.  new X(args);<br><br></li><li>inline object creation form e.g. {key1: value1, key2: value2} etc<br>


<br></li><li>regexps i.e. /regex here/<br><br>?</li></ol></ol></div><div><br></div><div>Thanks!<br>Mikael</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">2014-05-06 23:46 GMT+02:00 Marc Feeley <span dir="ltr"><<a href="mailto:feeley@iro.umontreal.ca" target="_blank">feeley@iro.umontreal.ca</a>></span>:<br>



<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><br>
On May 6, 2014, at 5:40 PM, Mikael <<a href="mailto:mikael.rcv@gmail.com" target="_blank">mikael.rcv@gmail.com</a>> wrote:<br>
<br>
><br>
><br>
><br>
> 2014-05-06 23:32 GMT+02:00 Marc Feeley <<a href="mailto:feeley@iro.umontreal.ca" target="_blank">feeley@iro.umontreal.ca</a>>:<br>
><br>
> On May 6, 2014, at 4:22 PM, Mikael <<a href="mailto:mikael.rcv@gmail.com" target="_blank">mikael.rcv@gmail.com</a>> wrote:<br>
><br>
> > Dear Marc,<br>
> ><br>
> > Just curious, Gambit's JS backend, it uses the JS VM:s GC right -<br>
> ><br>
> > How do you make the SCM to JS object mapping deliver that?<br>
> ><br>
> > I mean, say, a cons cell, a vector, a closure, a firstclass continuation and a stack frame, about how are those mapped to JS objects as for the JS VM to be able to GC them just as it does with ordinary values?<br>




> ><br>
> >  - Gambit uses numbers for object references ordinarily, so I guess the object mapping has been done deeper than that, so that actual JS object references are used as SCM object references by the JS backend.<br>




><br>
> 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.<br>




><br>
> 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.<br>




><br>
> 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?<br>
><br>
> E.g.<br>
><br>
> var frame1 = [value, value ...... ];<br>
><br>
> var frame2 [value, ........ frame1, ...];<br>
><br>
<br>
</div></div>Exactly.<br>
<br>
The details of how the chain of frames is created when the continuation is captured are given in the paper “<a href="http://users-cs.au.dk/danvy/sfp12/papers/thivierge-feeley-paper-sfp12.pdf" target="_blank">http://users-cs.au.dk/danvy/sfp12/papers/thivierge-feeley-paper-sfp12.pdf</a>”.<br>




<span><font color="#888888"><br>
Marc<br>
<br>
</font></span></blockquote></div><br></div></div>