6b4bde14e1
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1903 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
34 lines
1.4 KiB
Plaintext
34 lines
1.4 KiB
Plaintext
================================================================
|
|
Logtalk - Open source object-oriented logic programming language
|
|
Release 2.30.1
|
|
|
|
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.
|