alice
library
manual.

Alice Project

The STAMP signature


________ Synopsis ____________________________________________________

    signature STAMP
    functor MkStamp () :> STAMP
    structure GlobalStamp : STAMP
  

The STAMP signature provides an abstract data type representing time stamps. The MkStamp functor can be used to generate arbitrarily many stamp types. The GlobaStamp structure provides globally unique names (GUIDs).

See also: HASHABLE, ORDERED


________ Import ______________________________________________________

    import signature STAMP from "x-alice:/lib/data/STAMP-sig"
    import functor MkStamp from "x-alice:/lib/data/MkStamp"
    import structure GlobalStamp from "x-alice:/lib/data/GlobalStamp"

________ Interface ___________________________________________________

    signature STAMP =
    sig
	eqtype stamp
	type t = stamp

	val stamp :     unit -> stamp
	val toString :  stamp -> string

	val equal :     stamp * stamp -> bool
	val compare :   stamp * stamp -> order
	val hash :      stamp -> int
    end
  

________ Description _________________________________________________

eqtype stamp
type t = stamp

The type of stamps.

stamp ()

Creates a new stamp that is different from any other stamp value that has been generated by the same structure. Raises Overflow if no more stamps are available.

toString z

Returns a string identifying the stamp z. For all stamps generated from the same structure, toString will return distinct strings.

equal (z1, z2)

An explicit equality function on stamps. Equivalent to op=.

compare (z1, z2)

A total ordering on stamps. For stamp types generated by the MkStamp functor it returns EQUAL if z1 = z2, LESS if z1 has been created before z2, and GREATER otherwise. For global stamps, the ordering is arbitrary.

hash i

A hash function on stamps.



last modified 2007/Mar/30 17:10