Logtalk 2.17.2 files.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1076 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
pmoura
2004-06-13 18:04:28 +00:00
parent 9543ecf436
commit d029e6c3fc
170 changed files with 2022 additions and 772 deletions

View File

@@ -1,13 +1,36 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all entities in this example consult the dynpred.loader
utility file (note that this is a Prolog file).
To load all entities in this example compile and load the loader file:
This folder contains examples of using some of the built-in database
handling methods.
| ?- logtalk_load(loader).
This folder contains examples of using some of the built-in database
handling methods. Two hierarchies are provided, one prototype-based,
and the other class-based, in order to illustrate the differences
between asserting predicates in a class and in a prototype.
The following objects are defined:
root
root of the protoype hierarchy; declares and defines a public,
dynamic predicate
descendant
simple prototype extending the root prototype
class
root of the class hierarchy; declares and defines a public predicate
metaclass
class metaclass
instance
simple instance of class class
prototype
simple prototype used to illustrate how the scope of asserted
predicates depends on the target object (this, self, or a explicit
object)

View File

@@ -1,12 +1,18 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% Sending to descendant the message p/1, returns the definition in root:
% start by loading the example:
| ?- logtalk_load(loader).
...
% sending to descendant the message p/1, returns the definition in root:
| ?- descendant::p(Value).
@@ -14,7 +20,7 @@ Value = root
yes
% Asserting a local definition for p/1 in descendant overrides the inherited
% asserting a local definition for p/1 in descendant overrides the inherited
% definition:
| ?- descendant::(assertz(p(descendant)), p(Value)).
@@ -23,7 +29,7 @@ Value = descendant
yes
% If we retract the local definition, again the inherited definition form root
% if we retract the local definition, again the inherited definition form root
% will be used:
| ?- descendant::(retractall(p(_)), p(Value)).
@@ -48,7 +54,7 @@ X = class
yes
% If we assert a clause for a new predicate, p2/1, in the class
% if we assert a clause for a new predicate, p2/1, in the class
% (a side-effect being a dynamic declaration of the predicate):
| ?- class::assertz(p2(class)).
@@ -71,7 +77,7 @@ X = class
yes
% Using a prototype, assert three new predicates (the method object_assert/0
% using a prototype, assert three new predicates (the method object_assert/0
% asserts the predicate public_predicate/0 from outside the prototype; the
% method self_assert/0 asserts the predicate protected_predicate/0 in self;
% the method this_assert/0 asserts the predicate private_predicate/0 in this):

View File

@@ -1 +1,6 @@
:- object(instance,
instantiates(class)).
:- end_object.

View File

@@ -0,0 +1,9 @@
:- initialization(
logtalk_load([
root,
descendant,
metaclass,
class,
instance,
prototype])).