| 1 | ================================================================ |
|---|
| 2 | Logtalk - Open source object-oriented logic programming language |
|---|
| 3 | Release 2.35.0 |
|---|
| 4 | |
|---|
| 5 | Copyright (c) 1998-2009 Paulo Moura. All Rights Reserved. |
|---|
| 6 | Logtalk is free software. You can redistribute it and/or modify |
|---|
| 7 | it under the terms of the "Artistic License 2.0" as published by |
|---|
| 8 | The Perl Foundation. Consult the "LICENSE.txt" file for details. |
|---|
| 9 | ================================================================ |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | To load this example and for sample queries, please see the SCRIPT.txt file. |
|---|
| 13 | |
|---|
| 14 | Example adapted from the chapter "Classifying Prototype-Based Programming |
|---|
| 15 | Languages" by Christophe Dony, Jacques Malenfant, and Daniel Bardou, found |
|---|
| 16 | on the book "Prototype-Based Programming - Concepts, Languages, and |
|---|
| 17 | Applications" published by Springer. |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | This prototype programming example illustrates how we can do both property |
|---|
| 21 | sharing and value sharing in Logtalk by calling the built-in predicate |
|---|
| 22 | modification methods asserta/1, assertz/1, and retract/1 either in the |
|---|
| 23 | context of "this" or in the context of "self". |
|---|
| 24 | |
|---|
| 25 | In this example we have a prototype, joePerson, containing general data on |
|---|
| 26 | Joe such as its age, name, or address, and four descendant prototypes or |
|---|
| 27 | viewpoints, joeSportsman, joeEmployee, joeChessPlayer, and joeFilmEnthusiast. |
|---|
| 28 | Each descendant contains data related to a particular viewpoint about Joe. |
|---|