Some types of ECLiPSe objects can alternatively be referred to by a name (alias) or by anonymous handle. These include
This predicate maps a name to a handle, i.e. it obtains an anonymous handle for an existing named object. This is needed when one wants to use generic operations (such as mutual exclusion or conditions for thread synchronisation) on the object, because the corresponding primitives accept only handles.
Note that for some types of object, Name can be a compound term. In those cases, only the functor (name/arity) of Name is important for the lookup.
Generally, alias names should be used sparingly, because they prevent automatic garbage collection of objects.
% Get a handle for the current 'output' stream ?- name_to_handle(stream, output, H). H = $&(stream,1) Yes (0.00s cpu) % Declare a store and a record, then get handles: ?- local store(shed). Yes (0.00s cpu) ?- local record(foo/1). Yes (0.00s cpu) ?- name_to_handle(store, shed, H). H = $&(store,"17h3") Yes (0.00s cpu) ?- name_to_handle(shelf, shed, H). No (0.00s cpu) ?- name_to_handle(record, foo, H). No (0.00s cpu) ?- name_to_handle(record, foo(_), H). H = $&(record,"371bt3") Yes (0.00s cpu)