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.
Alexander
Alexander Shendi Alexander.Shendi@web.de schrieb:
Dear list,
how do I return values from a "##inline-host-code" form?
Here is my attempt, but it doesn't seem to work ...
(define (command-line) (vector->list (##inline-host-code "var vect = new Gambit_vector(); for(i=0; i < process.argv.length; i++) { vect.a[i] = process.argv[i]; } Gambit_r1 = vect; ")))
Many thanks in advance,
Alexander
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Afficher les réponses par date
On 2013-10-01, at 9:08 PM, Alexander Shendi Alexander.Shendi@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
On 2013-10-01, at 9:14 PM, Marc Feeley feeley@iro.umontreal.ca wrote:
On 2013-10-01, at 9:08 PM, Alexander Shendi Alexander.Shendi@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)