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 *)
15 val all : unit -> (stringref * string) list
18 structure Stringref :> STRINGREF =
26 (* warning: calling reset() may jeopardize uniqueness of stringrefs! *)
27 fun reset () = ( counter := 1 ; strings := [] )
28 fun new (s : string) = !counter before ( strings := (!counter, s) :: !strings ; counter := !counter + 1 )
32 fun name t = "S" ^ Int.toString t
34 fun compare (t1,t2) = Int.compare (t1,t2)