3 * Like temporaries, except more different
4 * Author: Joshua Wise <jwise@cs.cmu.edu>
11 val reset : unit -> unit (* resets stringref numbering *)
12 val new : string -> stringref (* returns a unique new stringref *)
13 val name : stringref -> string (* returns the name of a stringref *)
14 val compare : stringref * stringref -> order (* comparison function *)
17 structure Stringref :> STRINGREF =
25 (* warning: calling reset() may jeopardize uniqueness of stringrefs! *)
26 fun reset () = ( counter := 1 ; strings := [] )
27 fun new (s : string) = !counter before ( strings := (!counter, s) :: !strings ; counter := !counter + 1 )
30 fun name t = "S" ^ Int.toString t
32 fun compare (t1,t2) = Int.compare (t1,t2)