l...@gnu.org (Ludovic Courtès) skribis: > Germán Diago <germandi...@gmail.com> skribis:
[...] >> 4.- When writing a FFI from C++ functions, I know how guile code will >> look, but I couldn't find any Ecmascript mapping documentation. Any >> pointers where I could find something? > > In theory it should be possible to import and use Scheme functions from > ECMAscript. See > <http://wingolog.org/archives/2009/02/22/ecmascript-for-guile>. Here’s a session that uses the FFI from ECMAscript to bind the C library’s ‘sqrt’ function: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,L ecmascript Happy hacking with ECMAScript! To switch back, type `,L scheme'. ecmascript@(guile-user)> require('system.foreign'); ;;; <unknown-location>: warning: possibly unbound variable `require' $1 = #<<js-module-object> 27b94b0> ecmascript@(guile-user)> this['dynamic-link']; $2 = #<procedure dynamic-link (#:optional _)> ecmascript@(guile-user)> this['dynamic-func'] ('sqrt', this['dynamic-link']()); $3 = #<pointer 0x7f5d7d79aae0> ecmascript@(guile-user)> this['list'] ($1['double']); $8 = (2) ecmascript@(guile-user)> $1['pointer->procedure'] ($1['double'], $3, $8); $9 = #<procedure 2a5fa20 (_)> ecmascript@(guile-user)> $9 (2); $10 = 1.4142135623730951 --8<---------------cut here---------------end--------------->8--- A bit verbose, but funny. :-) Ludo’.