Sidekick_base.ID
Unique Identifiers
We use generative identifiers everywhere in Sidekick_base
. Unlike strings, there are no risk of collision: during parsing, a new declaration or definition should create a fresh ID.t
and associate it with the string name, and later references should look into some hashtable or map to get the ID corresponding to a string.
This allows us to handle definition shadowing or binder shadowing easily.
val make : string -> t
make s
creates a new identifier with name s
and some internal information. It is different than any other identifier created before or after, even with the same name.
val makef : ('a, Stdlib.Format.formatter, unit, t) Stdlib.format4 -> 'a
makef "foo %d bar %b" 42 true
is like make (Format.asprintf "foo %d bar %b" 42 true)
.
val id : t -> int
Unique integer counter for this identifier.
val to_string : t -> string
Print identifier.
val to_string_full : t -> string
Printer name and unique counter for this ID.
val ser : t -> Sidekick_util.Ser_value.t
val deser : t Sidekick_util.Ser_decode.t
include Sidekick_sigs.EQ_ORD_HASH_PRINT with type t := t
include Sidekick_sigs.EQ with type t := t
include Sidekick_sigs.ORD with type t := t
include Sidekick_sigs.HASH with type t := t
val hash : t -> int
include Sidekick_sigs.PRINT with type t := t
val pp : t Sidekick_sigs.printer
val pp_name : t CCFormat.printer
val pp_full : t CCFormat.printer