Knowledge.NameFully qualified names.
type t = nameinclude Core_kernel.Bin_prot.Binable.S with type t := tval create : ?package:string -> string -> tcreate ?package name creates a fully qualified name.
The package and name strings can contain any characters all treated literally, e.g., the : character won't be treated as a separator neither it will break anything.
If package is not specified, then it defaults to the "user" package.
val read : ?package:string -> string -> tread ?package input reads a full name from input.
This function will parse the input and return a fully-qualified name that corresponds to the input, using package as the currently opened package. The input syntax is
name = string, ":", string
| ":", string
| string
string = ?a sequence of any characters?Not all characters in the input string are treated literally, the following two characters have a special interpretation:
'\\' the escape character;':' the package separator character.The escape character disables a special interpretation of the consequent character. The package separator denotes the place in the input where the package name ends and the name part starts.
If package is specified then it is treated literally (as in the create function). The same as in create it defaults to the "user" package.
If input doesn't denote a fully qualified name (i.e., there is no ':' special character in input, then the read name is qualified with the passed package, otherwise the package is defined by the input.
The function is expected to work with the output of the show function, so that for all n, read (show n) = n. However, it is robust enough to accept any user inputs, even if it is not a well-formed input, e.g., when an escape character is used to escaped a non-special character or when input contains more than one unescaped separators. In case of invalid input, all special characters that doesn't make sense are treated literally and the first special ':' denotes the end of the package field. If the input is not valid, then it is possible that show (read s) <> s, since the output of show is always valid, e.g.
show@@read "hello:cruel:world" = "hello:cruel\\:world"
val show : t -> stringshow name is the readable representation of name.
The name is represented as <package>:<name>, with all special characters escaped. See the read function for more information.
val unqualified : t -> stringunqualified name is the unqualified name.
Returns the name without the package specifier.
val package : t -> stringpackage name is the package of the name.
val str : unit -> t -> stringstr () x = show x shows x.
This function is useful with printf-style functions that output to a string.
val hash : t -> inthash name the name hash.
include Base.Comparable.S with type t := tval comparator : (t, comparator_witness) Base__.Comparator.comparatorinclude Core_kernel.Binable.S with type t := tval bin_size_t : t Bin_prot.Size.sizerval bin_write_t : t Bin_prot.Write.writerval bin_read_t : t Bin_prot.Read.readerval __bin_read_t__ : (int -> t) Bin_prot.Read.readerval bin_writer_t : t Bin_prot.Type_class.writerval bin_reader_t : t Bin_prot.Type_class.readerval bin_t : t Bin_prot.Type_class.tinclude Core_kernel.Pretty_printer.S with type t := tval pp : Base__.Formatter.t -> t -> unit