Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 2128 invoked from network); 13 Apr 2007 11:44:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Apr 2007 11:44:06 -0000 Received: (qmail 17422 invoked by uid 500); 13 Apr 2007 11:44:08 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 17408 invoked by uid 500); 13 Apr 2007 11:44:08 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 17396 invoked by uid 99); 13 Apr 2007 11:44:08 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Apr 2007 04:44:08 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [83.221.35.45] (HELO antares.wpp-service.de) (83.221.35.45) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Apr 2007 04:44:01 -0700 Received: from outgoing.e-tecture.com ([83.221.34.4] helo=swellerwsx) by antares.wpp-service.de with esmtp (Exim 4.43) id 1HcKBn-0001R5-La for users@cocoon.apache.org; Fri, 13 Apr 2007 13:43:39 +0200 From: "Franziska Witzani" To: Subject: AW: Continuations: Snapshot or Pointers? Date: Fri, 13 Apr 2007 13:43:37 +0200 Message-ID: <000d01c77dc0$f9ad3760$f0001cac@frankfurt.etecture.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <5ce22775cbe592913db4354e977e6e5d@localhost> Thread-Index: Acd9QmigoOoBSVL/SnKMIX/txH/jUAAehJbg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-Virus-Checked: Checked by ClamAV on apache.org Hi Jason, hi Joerg! cocoon.createPageLocal() was exactly what I've been looking for. Thanks = a lot!=20 @Joerg: what you said about the difference between values of variables = and references to objects is true for saving them in the = PageLocal-Object. In Continuations Flowscript-Variables seem to be only referenced as = well. This proves this little sample: function main() { var random =3D Math.round( Math.random() * 9 ) + 1; var hint =3D "Noch keine Eingaben."; var guesses =3D 0; while(true) { cocoon.sendPageAndWait("guess.jxt", {"random" : random, "hint" : = hint, "guesses" : guesses}); var guess =3D parseInt(cocoon.request.get("guess")); guesses++; =20 if(guess>random) { hint =3D "N=C3=B6, niedriger!"; } else if(guess wrote: > On 12.04.2007 16:02, Franziska Witzani wrote: >=20 >> According to the documentation I have (especially the book of Stephan >> Niedermeier), a continuation is a snapshot of the variables of the >> flowscript (by the time the continuation is created/saved) and a = pointer > to >> the point of the flowscript which actually is being executed. >> >> I experienced, that this is not exactly the case. What seems to be = saved >> within the continuation is not a snapshot of the variables, but only >> pointers to their values. >> >> (For example, if you have a counter, which is incremented after each >> "sendPageAndWait()" it will not be set back if you go back with >> continuations, but always hold the highest value.) >=20 > They are indeed pointers, not snapshots. But this is only true for > objects. AFAIK there is no way to point to a primitive type, they are > always passed by value, not by reference. This means a simple counter > should indeed be resetted going back to an old continuation. But > somebody else can correct me on this. Torsten? > >> Is there a way to change that by configuring something, or will I = have > to >> change the Cocoon-source code or find another way around it? >=20 > No, there is no way to configure it. Actually I wonder how this should > be possible at all. How do you want to store and restore an object? I > can only imagine serializing and deserializing objects, but I'm not > aware of such an implementation. It would probably quite nice as you > don't need to care about any object state, but it's limiting to a > certain extend (to Serializable actually) and maybe not well = performing. I've never tried using it, but if I understand the Flowscript = documentation correctly, cocoon.createPageLocal() will create an object = that restores its state at the time the continuation was created. = Franziska this may fill your need. --Jason --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org