# Compiled by:
#
src/lib/c-kit/src/ast/ast.sublib# A generic for creating new categories of unique ids
generic package uid_g ( initial: Int;
prefix: String;
)
:
Uid # Uid is from
src/lib/c-kit/src/ast/uid.api{
Uid = Int;
initial = initial;
counter = REF initial; # XXX BUGGO FIXME more mutable global state. :( Needs to be moved to a state record.
fun new ()
=
{ n = *counter;
counter := n + 1;
n;
};
fun reset n
=
counter := n;
fun to_string x
=
prefix + (int::to_string x);
to_unt = unt::from_int;
fun equal (uid: Uid, uid')
=
uid == uid';
compare = int::compare;
};
## Copyright (c) 1998 by Lucent Technologies
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.