get the value associated with a virtual handle
handle_value(file,FileHandle,"DEMONSTRATION")
handle_value(VirtualHandle,RealHandle,ErrorString)(i,o,i)
handle(VirtualHandle) (i) virtual handle to be evaluated
void(RealHandle) (i) value associated with the virtual handle
Returns the RealHandle that was associated with the virtual handle by a call to new_handle (). Together with new_handle() and rem_handle (), the user can use this predicate to access his own data via virtual file handles. The idea is that a value obtained at runtime can be associated with a constant virtual handle known at compile time (through new_handle()). The value can then be accessed at any place in the program without the need of passing arguments with every call. The use of database predicates can accomplish the same thing (in fact the handle routines do just that), but as we needed this for our file and window management, we thought we might as well export these predicates. We suggest you use these predicates in a separate 'library' module only, as errors in handle access can violate system integrity.
new_file(my_data,"Hello World",user_string,"OPEN DATA"). .... handle_value(my_data,X,"GET DATA"), write(X),nl. .... rem_handle(my_data,_,"LOSE DATA").
A runtime error occurs if an invalid handle is given.
prolog-process, client-server, object