Logtalk 2.25.0 files.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1288 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
pmoura
2005-05-23 23:33:41 +00:00
parent 0b420f5493
commit 72b037275f
291 changed files with 2828 additions and 1675 deletions

View File

@@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.24.0
Release 2.25.0
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================

View File

@@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.24.0
Release 2.25.0
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================
@@ -12,7 +12,7 @@ Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
...
% first variant of the "diamond problem", defined in the "diamond1" metafile:
% first variant of the "diamond problem", defined in the "diamond1" source file:
| ?- d1::m.
@@ -20,7 +20,7 @@ Redefinition of method m/0 in object b1
yes
% second variant of the "diamond problem", defined in the "diamond2" metafile:
% second variant of the "diamond problem", defined in the "diamond2" source file:
| ?- d2::m.
@@ -28,7 +28,7 @@ Redefinition of method m/0 in object c2
yes
% third variant of the "diamond problem", defined in the "diamond3" metafile:
% third variant of the "diamond problem", defined in the "diamond3" source file:
| ?- d3::b3_m.

View File

@@ -0,0 +1,57 @@
/*
These objects illustrate a variant of the "diamond problem" using
a prototype hierarchy.
In this simple case, the inherited definition which will be used in the
bottom object is determined by the Logtalk predicate lookup algorithm.
*/
% root object, declaring and defining a predicate m/0:
:- object(a1).
:- public(m/0).
m :-
this(This),
write('Default definition of method m/0 in object '),
write(This), nl.
:- end_object.
% an object descending from the root object, which redefines predicate m/0:
:- object(b1,
extends(a1)).
m :-
this(This),
write('Redefinition of method m/0 in object '),
write(This), nl.
:- end_object.
% another object descending from the root object, which also redefines predicate m/0:
:- object(c1,
extends(a1)).
m :-
this(This),
write('Redefinition of method m/0 in object '),
write(This), nl.
:- end_object.
% bottom object, descending from the two previous objects and, as such, inheriting
% two definitions for the predicate m/0:
:- object(d1,
extends(b1, c1)).
:- end_object.

View File

@@ -0,0 +1,64 @@
/*
These objects illustrate a variant of the "diamond problem" using
a prototype hierarchy.
In this simple case, a solution for making the overridden definition inherited
by the bottom object the visible one is implemented using the alias/3 predicate
directive.
*/
% root object, declaring and defining a predicate m/0:
:- object(a2).
:- public(m/0).
m :-
this(This),
write('Default definition of method m/0 in object '),
write(This), nl.
:- end_object.
% an object descending from the root object, which redefines predicate m/0:
:- object(b2,
extends(a2)).
m :-
this(This),
write('Redefinition of method m/0 in object '),
write(This), nl.
:- end_object.
% another object descending from the root object, which also redefines predicate m/0:
:- object(c2,
extends(a2)).
m :-
this(This),
write('Redefinition of method m/0 in object '),
write(This), nl.
:- end_object.
% bottom object, descending from the two previous objects and, as such, inheriting
% two definitions for the predicate m/0; the overridden definition inherited from
% object "c2" is renamed using the alias/3 directive and then we redefine the
% predicate m/0 to call the renamed definition:
:- object(d2,
extends(b2, c2)).
:- alias(c2, m/0, c2_m/0).
m :-
::c2_m.
:- end_object.

View File

@@ -0,0 +1,61 @@
/*
These objects illustrate a variant of the "diamond problem" using
a prototype hierarchy.
In this simple case, a solution is presented for making two conflicting
definitions inherited by the bottom object visible through the use of the
alias/3 predicate directive.
*/
% root object, declaring and defining a predicate m/0:
:- object(a3).
:- public(m/0).
m :-
this(This),
write('Default definition of method m/0 in object '),
write(This), nl.
:- end_object.
% an object descending from the root object, which redefines predicate m/0:
:- object(b3,
extends(a3)).
m :-
this(This),
write('Redefinition of method m/0 in object '),
write(This), nl.
:- end_object.
% another object descending from the root object, which also redefines predicate m/0:
:- object(c3,
extends(a3)).
m :-
this(This),
write('Redefinition of method m/0 in object '),
write(This), nl.
:- end_object.
% bottom object, descending from the two previous objects and, as such, inheriting
% two definitions for the predicate m/0; both inherited definitions are renamed
% using the alias/3 directive:
:- object(d3,
extends(b3, c3)).
:- alias(b3, m/0, b3_m/0).
:- alias(c3, m/0, c3_m/0).
:- end_object.