Logtalk 2.15.5 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@955 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<?xml-stylesheet type="text/css" href="../styles.css" ?>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
|
||||
<head>
|
||||
<title>A reflective class-based system</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
|
||||
<title>Logtalk tutorial: a reflective class-based system</title>
|
||||
<link rel="stylesheet" href="../styles.css" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<hr />
|
||||
<h1><a class="back" title="Return to index" href="index.html#reflection">A reflective class-based system</a></h1>
|
||||
<div class="navtop">
|
||||
<a href="../index.html">contents</a> > <a href="index.html">tutorial</a>
|
||||
</div>
|
||||
|
||||
<h1>A reflective class-based system</h1>
|
||||
|
||||
<p>
|
||||
When compiling an object, Logtalk distinguishes prototypes from instance or classes by examining the object relations. If an object instantiates and/or specializes another object, then it is compiled as an instance or class, otherwise it is compiled as a prototype. A consequence of this is that, in order to work with instance or classes, we always have to define root objects for the instantiation and specialization hierarchies (however, we are not restricted to a single hierarchy). The best solution is often to define a reflective class-based system <a href="../bibliography.html#Maes87">[Maes 87]</a>, where every class is also an object and, as such, an instance of some class.
|
||||
@@ -23,8 +27,7 @@ When compiling an object, Logtalk distinguishes prototypes from instance or clas
|
||||
In this example, we are going to define the basis for a reflective class-based system, based on an extension of the ideas presented in <a href="../bibliography.html#Cointe87">[Cointe 87]</a>. This extension provides, along with root objects for the instantiation and specialization hierarchies, explicit support for abstract classes <a href="../bibliography.html#Moura94">[Moura 94]</a>.
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
<h2><a class="back" title="Return to index" name="classes" href="index.html#reflection_classes">Defining the base classes</a></h2>
|
||||
<h2>Defining the base classes<a name="classes"></a></h2>
|
||||
|
||||
<p>
|
||||
We will start by defining three classes: <code>object</code>, <code>abstract_class</code>, and <code>class</code>. The class <code>object</code> will contain all predicates common to all objects. It will be the root of the inheritance graph:
|
||||
@@ -65,8 +68,7 @@ The class <code>class</code> specializes <code>abstract_class</code> by adding p
|
||||
Note that all three objects are instances of class <code>class</code>. The instantiation and specialization relationships are choosen so that each object may use the predicates defined in itself and in the other two objects, with no danger of method lookup endless loops.
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
<h2><a class="back" title="Return to index" name="summary" href="index.html#reflection_summary">Summary</a></h2>
|
||||
<h2>Summary<a name="summary"></a></h2>
|
||||
|
||||
<ul>
|
||||
<li>An object that does not instantiate or specialize other objects is always compiled as a prototype.</li>
|
||||
@@ -78,15 +80,16 @@ Note that all three objects are instances of class <code>class</code>. The insta
|
||||
<li>The distinction between abstract classes and instantiable classes is a operational one, depending on the class inherited methods. A class is instantiable if inherits methods for creating instances. Conversely, a class is abstract if does not inherit any instance creation method.</li>
|
||||
</ul>
|
||||
|
||||
<hr />
|
||||
<p class="center">
|
||||
<strong><a href="index.html">Previous</a> | <a href="profiling.html">Next</a> | <a href="index.html">Table of Contents</a> | <a href="../bibliography.html">Bibliography</a> | <a href="../glossary.html">Glossary</a></strong>
|
||||
</p>
|
||||
<p class="center">
|
||||
Last updated on: August 6, 2002
|
||||
</p>
|
||||
<hr />
|
||||
<div class="navbottom">
|
||||
<a href="index.html">previous</a> | <a href="../glossary.html">glossary</a> | <a href="profiling.html">next</a>
|
||||
</div>
|
||||
|
||||
<div class="copyright">
|
||||
Copyright © <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> — <a href="http://www.logtalk.org">Logtalk.org</a>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<p><span class="bleft"><a href="http://validator.w3.org/check/referer">XHTML</a> + <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a></span><span class="bright">Last updated on: December 23, 2003</span></p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user