proper implementation of pointer_eq;
authorwenzelm
Tue Jun 21 18:55:57 2005 +0200 (2005-06-21)
changeset 165174699288139f4
parent 16516 0842635545c3
child 16518 086c6a97f340
proper implementation of pointer_eq;
src/Pure/ML-Systems/mosml.ML
     1.1 --- a/src/Pure/ML-Systems/mosml.ML	Tue Jun 21 18:55:44 2005 +0200
     1.2 +++ b/src/Pure/ML-Systems/mosml.ML	Tue Jun 21 18:55:57 2005 +0200
     1.3 @@ -19,12 +19,7 @@
     1.4  
     1.5  (** ML system related **)
     1.6  
     1.7 -(*proper implementation available?*)
     1.8 -fun pointer_eq (x:''a, y) = false;
     1.9 -
    1.10 -
    1.11 -(* Poly/ML emulation *)
    1.12 -
    1.13 +load "Obj";
    1.14  load "Bool";
    1.15  load "Int";
    1.16  load "Real";
    1.17 @@ -33,6 +28,10 @@
    1.18  load "Process";
    1.19  load "FileSys";
    1.20  
    1.21 +(*low-level pointer equality*)
    1.22 +local val cast : 'a -> int = Obj.magic
    1.23 +in fun pointer_eq (x:'a, y:'a) = (cast x = cast y) end;
    1.24 +
    1.25  (*proper implementation available?*)
    1.26  structure IntInf =
    1.27  struct
    1.28 @@ -93,6 +92,7 @@
    1.29        f x;
    1.30  end;
    1.31  
    1.32 +
    1.33  (* ML command execution *)
    1.34  
    1.35  (*Can one redirect 'use' directly to an instream?*)