| Did you know ... | Search Documentation: |
| Example |
Consider the following code fragment:
:- pce_begin_class(label_text(string, name), text).
resource(label_font, font, '@helvetica_bold_14', "Font used for labels").
initialise(Text, String:string, Format:[name]) :->
"Initialise from string and format"::
send(Text, send_super, initialise(String, Format, ?(Text, resource_value, label_font))).:- pce_end_class.
The call to pce_begin_class/2
will create the class and
set the
<->term_names variable of the class.
The resource/4 declaration will attach a
resource (e.i. interface to the X-windows
default database) to the class) using class->resource.
The initialise declaration will attach a method to the
class and assert a clause
in the Prolog database. The result of the translation will be:
vector(string, '[name]'),
message(@prolog,
send_initialise_label_font,
@receiver, @arg1, @arg2))).and the clause
send_initialise_label_text(Text, String, Format) :-
send(Text, send_super, initialise(String, Format, ?(Text, resource_value, label_font))).The call to pce_end_class/0 deletes the term_expansion/2 clause inserted by pce_begin_class/3 and destroys all operator declarations inserted by this call.
Parent: Defining Classes