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>Dynamic object attributes</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
|
||||
<title>Logtalk tutorial: dynamic object attributes</title>
|
||||
<link rel="stylesheet" href="../styles.css" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<hr />
|
||||
<h1><a class="back" title="Return to index" href="index.html#lists">Dynamic object attributes</a></h1>
|
||||
<div class="navtop">
|
||||
<a href="../index.html">contents</a> > <a href="index.html">tutorial</a>
|
||||
</div>
|
||||
|
||||
<h1>Dynamic object attributes</h1>
|
||||
|
||||
<p>
|
||||
In this example, we will illustrate the use of:
|
||||
@@ -28,8 +32,7 @@ In this example, we will illustrate the use of:
|
||||
by defining a category that implements a set of predicates for handling dynamic object attributes.
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
<h2><a class="back" title="Return to index" name="category" href="index.html#attributes_category">Defining a category</a></h2>
|
||||
<h2>Defining a category<a name="category"></a></h2>
|
||||
|
||||
<p>
|
||||
We want to define a set of predicates to handle dynamic object attributes. We need public predicates to set, get, and delete attributes, and a private dynamic predicate to store the attributes values. Let us name these predicates <code>set_attribute/2</code> and <code>get_attribute/2</code>, for getting and setting an attribute value, <code>del_attribute/2</code> and <code>del_attributes/2</code>, for deleting attributes, and <code>attribute_/2</code>, for storing the attributes values.
|
||||
@@ -98,8 +101,7 @@ We have two new directives, <a title="Consult reference manual" href="../refman/
|
||||
Any protocol can be implemented by either an object, a category, or both.
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
<h2><a class="back" title="Return to index" name="importing" href="index.html#attributes_importing">Importing the category</a></h2>
|
||||
<h2>Importing the category<a name="importing"></a></h2>
|
||||
|
||||
<p>
|
||||
We reuse a category's predicates by importing them into an object:
|
||||
@@ -131,8 +133,7 @@ After compiling and loading this object and our category, we can now try queries
|
||||
no
|
||||
</pre>
|
||||
|
||||
<hr />
|
||||
<h2><a class="back" title="Return to index" name="summary" href="index.html#attributes_summary">Summary</a></h2>
|
||||
<h2>Summary<a name="summary"></a></h2>
|
||||
|
||||
<ul>
|
||||
<li>Categories are similar to objects: we just put our predicate directives and definitions bracketed by opening and ending category directives.</li>
|
||||
@@ -144,15 +145,16 @@ After compiling and loading this object and our category, we can now try queries
|
||||
<li>When do we use a category instead of an object? Whenever we have a set of closely related predicates that we want to reuse in several, unrelated, objects.</li>
|
||||
</ul>
|
||||
|
||||
<hr />
|
||||
<p class="center">
|
||||
<strong><a href="lists.html">Previous</a> | <a href="reflection.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="lists.html">previous</a> | <a href="../glossary.html">glossary</a> | <a href="reflection.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