Skip to content

Instantly share code, notes, and snippets.

@psihy
Created December 6, 2012 16:00
Show Gist options
  • Save psihy/4225578 to your computer and use it in GitHub Desktop.
Save psihy/4225578 to your computer and use it in GitHub Desktop.
FFI in BiwaScheme.
;; JavaScript の関数を呼び出す
;; e.g. rosso(fantasma)
(js-call (js-eval "rosso") fantasma)
;; クラスのインスタンスを生成する
;; e.g. new Tiro(finale)
(js-new "Tiro" finale)
;; クラスのメソッドを呼び出す
;; e.g. homu.attack(baretter, eagle, remington, m249)
(js-invoke homu "attack" baretta eagle remington m249)
;; クラスのメンバを参照する
;; e.g. walpurgis.night
(js-ref walpurgis "night")
;; クラスのメンバに代入する
;; e.g. magical.sayaka = "oktavia"
(js-set! magical "sayaka" "oktavia")
;; クラスのメンバに関数を渡す
;; e.g. goddess.madoka = function () { ...
(js-set! goddess "madoka" (js-closure (lambda () ...
;; 外部ファイルを読み込む
(js-load "mamisan.scm")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment