[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ]

The following SML program

  exception C;

  structure M :> sig exception A end =
  struct
    exception A = C
  end;

  (raise M.A) handle C => 42

returns the value 42 (according to SML/NJ and, I believe, the 1997 definition of Standard ML).

The signature ascription appears to assert that exception A is abstract in M, and yet we are able to raise the exception M.A and catch it as C outside the scope of M. It makes no difference whether the signature ascription is transparent or opaque. The equivalent OCaml program yields the same result.

Does this kind of code occur in practice?

Sam

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

Reply via email to