1.111 class obtain

Class ? is (pronounced as obtainer) is a template for the virtual machine instruction get in the same fashion as a message object is a template to the send operation. Obtainers are the most commonly used function objects.

Obtainers add a very powerful mechanism to PCE. Understanding them is critical for writing readable and fast PCE programs. Please study the examples. In the example below, an obtainer is used to combine dialog_item selections to create a single call to the application:

?- new(D, dialog),
   send(D, append, new(label)),		% for feedback
   send(D, append, new(Name, text_item(name, ''))),
   send(D, append, new(Age, text_item(age, ''))),
   send(D, append,
                button(create, message(@prolog, create_person,
                                                           Name?selection,
                                                           Age?selection))),
   send(D, open).

Of course, the application must define the predicate create_person.

See also
- @arg1
- topic Checking
- class get_method
- class block
- topic Obtainers
- object<-_slot
- object<-_references
- object<-_inspect
- object<-_flags
- object<-_class_name
- object<-_class
- object<-_arity
- object<-_arg
- object->_inspect
- object->_free

1.111.1 Instance variables

obtain <->_context:
Inherits description from: message-context