# HG changeset patch # User wenzelm # Date 897049271 -7200 # Node ID d7d525466221db876932a3eecdd52749351f0cdf # Parent 25da60d0a20b3899fe64df62923a1ebd09acda97 added object.ML; diff -r 25da60d0a20b -r d7d525466221 src/Pure/IsaMakefile --- a/src/Pure/IsaMakefile Tue Jun 02 15:08:42 1998 +0200 +++ b/src/Pure/IsaMakefile Fri Jun 05 14:21:11 1998 +0200 @@ -34,9 +34,9 @@ Thy/thy_parse.ML Thy/thy_read.ML Thy/thy_scan.ML Thy/thy_syn.ML \ Thy/use.ML attribute.ML axclass.ML basis.ML deriv.ML display.ML \ drule.ML envir.ML goals.ML install_pp.ML library.ML logic.ML \ - name_space.ML net.ML pattern.ML pure_thy.ML search.ML seq.ML sign.ML \ - sorts.ML table.ML tactic.ML tctical.ML term.ML theory.ML thm.ML \ - type.ML type_infer.ML unify.ML + name_space.ML net.ML object.ML pattern.ML pure_thy.ML search.ML \ + seq.ML sign.ML sorts.ML table.ML tactic.ML tctical.ML term.ML \ + theory.ML thm.ML type.ML type_infer.ML unify.ML @./mk diff -r 25da60d0a20b -r d7d525466221 src/Pure/ROOT.ML --- a/src/Pure/ROOT.ML Tue Jun 02 15:08:42 1998 +0200 +++ b/src/Pure/ROOT.ML Fri Jun 05 14:21:11 1998 +0200 @@ -16,6 +16,7 @@ (*basic utils*) use "library.ML"; use "table.ML"; +use "object.ML"; use "seq.ML"; use "name_space.ML"; use "term.ML"; diff -r 25da60d0a20b -r d7d525466221 src/Pure/object.ML --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Pure/object.ML Fri Jun 05 14:21:11 1998 +0200 @@ -0,0 +1,42 @@ +(* Title: Pure/object.ML + ID: $Id$ + Author: Markus Wenzel, TU Muenchen + +Generic objects of arbitrary type -- fool the ML type system via +exception constructors. +*) + +signature OBJECT = +sig + type T + type kind + val kind: string -> kind + val name_of_kind: kind -> string + val eq_kind: kind * kind -> bool + val kind_error: kind -> 'a +end; + +structure Object: OBJECT = +struct + + +(* anytype values *) + +type T = exn; + + +(* kinds *) + +datatype kind = Kind of string * stamp; + +fun kind name = Kind (name, stamp ()); + +fun name_of_kind (Kind (name, _)) = name; + +fun eq_kind (Kind (_, s1), Kind (_, s2)) = s1 = s2; + +fun kind_error k = + error ("## RUNTIME TYPE ERROR ##\nFailed to access " ^ quote (name_of_kind k) ^ " object"); + + +end;