[gambit-list] Returning values from ##inline-host-code

Marc Feeley feeley at iro.umontreal.ca
Wed Oct 2 21:51:16 EDT 2013


On 2013-10-01, at 9:14 PM, Marc Feeley <feeley at iro.umontreal.ca> wrote:

> 
> On 2013-10-01, at 9:08 PM, Alexander Shendi <Alexander.Shendi at web.de> wrote:
> 
>> Hi ,
>> 
>> I need to return values Form an "##inline-host-code" Form. Can I do this at all? See my attempt below. This is for node.JS. Many thanks in advance for your help.
> 
> The current code generation approach for ##inline-host-code does not allow this, but it should be easy to fix.  I'll take a look tomorrow.
> 
> Marc

I have made improvements to the universal backend which now has the procedures ##inline-host-expression and ##inline-host-statement to replace ##inline-host-code.  ##inline-host-expression must be used when the host code to inline computes a value.  ##inline-host-statement must be used when the host code is executed for side-effect, with no resulting value.

Below is an example.

Marc


(declare (extended-bindings) (not safe))

(define (get-name)
  (##inline-host-expression "prompt('enter name?')"))

(define (console.log text)
  (##inline-host-statement "console.log(Gambit_r1);\n"))

(define name (get-name))

(console.log name)



More information about the Gambit-list mailing list