Javaと相互呼び出し可能なScheme 処理系「ぶぶ」における継続機能と例外処理機能の実装

書誌事項

タイトル別名
  • Java ト ソウゴ ヨビダシ カノウ ナ Scheme ショリケイ ブブ ニ オケル ケイゾク キノウ ト レイガイ ショリ キノウ ノ ジッソウ
  • Implementation of Continuations and Exceptions for a Scheme System with Java Interface

この論文をさがす

抄録

「ぶぶ」は,Java 言語とのシームレスなインタフェースを備えたオブジェクト指向型のScheme 処理系である.Java の機能を最大限に利用しつつScheme を使って対話的にプログラミングができることを目標としており,Scheme の継続機能,Java の例外処理機能の両方に対応していることが望まれる.ぶぶではScheme とJava で記述したメソッドを相互に呼び出し合うことができる.Scheme部分の実行には専用に確保した制御スタックを使っているが,Java 部分の実行にはJava VM の制御スタックを使っている.したがって,完全なファーストクラスの継続を実現するためには,Java の継続も得なければならない.しかし,Java 言語はこのような手段を提供していない.そこで,継続オブジェクトを生成するときは実行中のScheme 部分だけの継続をヒープに保存しておき,Java 部分の継続はJava VM の制御スタック上に残しておくことにした.継続を呼び出すときにJava 部分の継続が制御スタック上に残っているかどうかを調べ,残っていれば完全な継続呼び出しとして動作する.残っていないときはScheme 部分だけの部分継続として呼び出す.また,Java の例外処理機能をScheme で記述したプログラムでも直接利用できるようにした.この例外処理機能は継続機能と同時に使うことができる.

“Bubu” is an object-oriented Scheme system with seamless interface to Java. Because the goal of Bubu is to provide an interactive environment of Scheme and draw out maximum functionality of Java, we expect it to support both first-class continuations of Scheme and the exception system of Java. In Bubu, methods written in Java and Scheme can call each other. The control stack for methods in Scheme is implemented by using an array object of Java. On the other hand, methods in Java uses the control stack of Java VM. Therefore, when a first-class continuation is captured, a continuation of Java must be also saved to heap. However, Java does not support this facility. In our proposal, when a continuation is captured, only a continuation of Scheme part is saved to heap and the continuation of Java part is left on the control stack of Java VM. When the continuation is called, whether the continuation of Java part is left on the stack of Java VM or not is checked, and if left, this call works as a traditional continuation call. If not, this works as a partial continuation call which has only the Scheme part. In addition, we developed a seamless interface to the Java exception system which can cooperate with the continuation facility.

収録刊行物

参考文献 (12)*注記

もっと見る

キーワード

詳細情報 詳細情報について

問題の指摘

ページトップへ