fenfire-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ff-cvs] fenfire/docs/pegboard swamp_easier--benja/peg.r...


From: Benja Fallenstein
Subject: [ff-cvs] fenfire/docs/pegboard swamp_easier--benja/peg.r...
Date: Mon, 22 Sep 2003 02:04:44 -0400

CVSROOT:        /cvsroot/fenfire
Module name:    fenfire
Branch:         
Changes by:     Benja Fallenstein <address@hidden>      03/09/22 02:04:43

Modified files:
        docs/pegboard/swamp_easier--benja: peg.rst 
Added files:
        docs/pegboard/swamp_easier_iteration--benja: .cvsignore peg.rst 

Log message:
        split peg as mudyc requested

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/docs/pegboard/swamp_easier--benja/peg.rst.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/docs/pegboard/swamp_easier_iteration--benja/.cvsignore?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/docs/pegboard/swamp_easier_iteration--benja/peg.rst?rev=1.1

Patches:
Index: fenfire/docs/pegboard/swamp_easier--benja/peg.rst
diff -u fenfire/docs/pegboard/swamp_easier--benja/peg.rst:1.1 
fenfire/docs/pegboard/swamp_easier--benja/peg.rst:1.2
--- fenfire/docs/pegboard/swamp_easier--benja/peg.rst:1.1       Sun Sep 21 
22:08:25 2003
+++ fenfire/docs/pegboard/swamp_easier--benja/peg.rst   Mon Sep 22 02:04:43 2003
@@ -21,6 +21,10 @@
 (Besides, easy-to-read and easy-to-use APIs are of course
 the right thing to have anyway.)
 
+Part of the original proposal in this PEG is split off
+into ``swamp_easier_iteration--benja`` because mudyc
+requested it.
+
 
 .. Issues
    ======
@@ -162,64 +166,8 @@
 ``Triples``
 -----------
 
-The iterator-like object, ``Triples``, shall have
-the following API::
-
-    Object sub, pred, ob;
-
-(These are ``null`` when the object hasn't been
-initialized, i.e., ``next()`` hasn't been called yet.)
-
-    /** Advance to the next triple. */
-    void next();
-
-    /** Whether there are any more triples to iterate through. */
-    boolean hasNext();
-
-    /** Indicate that this <code>Triples</code> object won't be
-     *  used any more.
-     *  This shall only be called by the code that has requested
-     *  this object from <code>ConstGraph</code> (through 
-     *  <code>.get()</code>). It's purpose is to tell the
-     *  <code>ConstGraph</code> that it can be re-used for the
-     *  next <code>get()</code>; <code>ConstGraph</code> can then
-     *  cache <code>Triples</code> objects, making life easier
-     *  for the garbage collector.
-     *  <p>
-     *  Calling this method is not obligatory. (If you don't,
-     *  this object will be garbage-collected normally.)
-     */
-    void free();
-
-    boolean loop() {
-        if(hasNext()) {
-            next();
-            return true;
-        } else {
-            free();
-            return false;
-        }
-    }
-
-The purpose of ``loop()`` is to enable the common loop
-pattern, ::
-
-    for(Triples t = graph.get(...); t.loop();) {
-        // ...
-    }
-
-which would otherwise have to be written as::
-
-    Triples t;
-    for(t = graph.get(...); t.hasNext(); t.next()) {
-        // ...
-    }
-    t.free();
-
-This isn't just harder to read, it also scopes ``t``
-wrongly. With the ``loop()`` pattern, the scope of ``t``
-is the body of the loop, which is exactly the code
-executed before ``free()`` is called.
+For the API of the iterator-like object, ``Triples``,
+see ``swamp_easier_iteration--benja``.
 
 
 ``Graph``




reply via email to

[Prev in Thread] Current Thread [Next in Thread]