Reading categories
I/O, Modules and System Interface
Symbols
Modules

Symbols

Identifiers are represented in CLAIRE with entities called symbols. Each identifier is represented by a symbol. A symbol is defined by a namespace (where the identifier belongs), a name (the sequence of character from the unqualified symbol) and a status. The status of a symbol is either private or export (the default status). When the status of an identifier is private, the reader will not recognize the qualified form from a module that is not a sub-module of that of the identifier. Therefore, the only way to read the identifier is inside its own namespace. When the status of the identifier is export, the qualified form gives access to the designated object, if the sharing declarations of namespaces have been properly set.

Each symbol may be bound to the object that it designates. The object becomes the value of the symbol. The name of the object must be the symbol itself. In addition, the symbol collects another piece of useful information: the module where its value (the named object) is defined. If the symbol is defined locally (through a private or export definition), this definition module is the same as the owner of the symbol itself. If the symbol is shared (if it was defined as an identifier of an above module), this module is a subpart of the owner of the symbol.

CLAIRE now supports a simple syntax for creating symbols directly, in addition to the various methods provided in the API. Symbols can be entered in the same way that they are printed, by indicating the module (namespace) to which the symbol belongs and the associated string, separated by a '/' :
 <claire symbol= <module>/<string>


categories Symbolsnormal dispatch Kernel method

gensym(s:string) -> symbol

gensym(s) generates randomly a new symbol prefixed by s.


categories Symbolsnormal dispatch Kernel method

gensym(self:void) -> symbol

gensym() generates randomly a new symbol.


categories Symbolsnormal dispatch Core method

get_value(self:string) -> any

returns the object whose name (in the default claire namespace) corresponds to the string s.


categories Symbolsnormal dispatch Core method

get_value(self:module, s:string) -> any

returns the object whose name (search from the namespace m) corresponds to the string s.


categories Symbolsnormal dispatch Kernel method

integer!(s:symbol) -> integer

integer!(s) returns a unique index associated to a symbol s


categories Symbolsnormal dispatch Kernel method

make_string(self:symbol) -> string

make_string(s) returns a string denoting the same identifier. If s is given in the qualified form (module/identifier), than the result will contain the name of the module ("module/identifier").


categories Symbolsnormal dispatch Kernel method

put(s:symbol, x:any) -> any

put(s,x) binds the symbol s to the object x.


categories Symbolsnormal dispatch Kernel method

string!(s:symbol) -> string

string! converts a symbol into a string. For example if toto is a symbol string!(toto) returns "toto". Unlike make_string, it returns the unqualified form :
 string!(Francois/agenda-> "agenda"
 whereas make_string(Francois/agenda-> "Francois/agenda"


categories Symbolsnormal dispatch Kernel method

symbol!(self:string) -> symbol

symbol!(s) returns the symbol associated to s in the claire module. A new symbol is created if no such symbol exists.


categories Symbolsnormal dispatch Kernel method

symbol!(s:string, m:module) -> symbol

symbol!(s,m) returns the symbol associated to s in the module m . A new symbol is created if no such symbol exists.