TAPL 読書会@東京 第9回

14 Exceptions
14.1 Raising Exceptions
(λx:Nat.0) error

(fix (λx:Bool.x)) error;
(λx:Bool.x) error;
(λx:Bool.x) (error true);

14.1.1 Exercise *
Wouldn't it be simpler just to require the programmer to annotate ERROR with
its intended type in each context where it is used?

14.1.2 Theorem
Suppose 't' is a closed, well-typed normal form. Then either 't' is a value or t = error.

14.2 Handling Exceptions
14.3 Exceptions Carrying Values
1.

2.

3.

4.

5.
Java uses classes instead of extensible variants to support user-defined exceptions.




14.3.1 Exercise ***
The explanation of extensible variant types in alternative 4 above is rather informal.



14.3.2 Exercise ****
We noted above that Java exceptions (those that are subclasses of Exception) are
a bit more strictly controlled than exceptions in ML (or the ones we have defined here):


14.3.3 Exercise ***

タグ:

+ タグ編集
  • タグ:

このサイトはreCAPTCHAによって保護されており、Googleの プライバシーポリシー利用規約 が適用されます。

最終更新:2012年02月11日 21:48