=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.29.4
Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved.
To load this example and for sample queries, please see the SCRIPT file.
A parametric object may be used to represent objects whose "state" is static
and set when the object is defined. However, there can be only one parametric
object with a given functor and arity. For example, if we define the following
parametric object:
:- object(circle(_Radius, _Color)).
...
:- end_object.
then the following terms may be interpreted as references to the object above:
circle(1, blue)
circle(2, yellow)
In the context of parametric objects, the above terms are know as "parametric
object proxies". Proxies represent different instantiations of a parametric
object parameters. They may be stored on the database as Prolog facts. This
results in a very compact representation, which can be an advantage when
dealing with a large number of objects with immutable state. However, this is
also a fragile solution as changes on the parametric object ancestors may
imply changes to the number and meaning of the parametric object parameters
which, in turn, may imply changes to all the Prolog facts used to represent
the individual objects.