From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
To: noah.b.lavine@gmail.com
Cc: guile-devel@gnu.org
Subject: Re: redo-safe-variables and redo-safe-parameters
Date: Sat, 13 Apr 2013 12:12:02 +0200 [thread overview]
Message-ID: <1725031.6ll3YGeLN9@warperdoze> (raw)
In-Reply-To: <26254241.alHDNf9hMe@warperdoze>
Hi Noha,
You asked of one example where fluid-let is not suitable. Well, one
key component of redo-safe-variables is that it's composable with
delayed compilation. Consider a two pass compiler, where in the first
pass closures are created and then in the next pass they will be
evaluated with arguments and lead to the final code. If we would like
to have user interaction in this and in pass 1, store and then redo
a state, the result would be as expected. Not so if the variables are
backtracking.
No over to the general discussion:
----------------------------------
I have spend a lot of time in guile-log, thesting out the
redo-safeness properties and got it working with respect to user
interaction and the use-cases in described in the spec that I send to
the list. Then I spend time cleaning up guile-log and documenting. Now
I've come to the postpone logic and things get's really
interesting. The postpone module will let you store a set of states
representing choice points, then evaluate some heuritstic leading to
an index describing the liklihood of success in that branch and then
it will sieve out the most likly branches and continue with them. The
imlpementation was well tested and worked quite ok in the guile-unify
repo. But it has bitrotten quite a lot and need a rewrite.
So I read the code and analyzed the old behavior in the light of
redo-safe variables and parameters. My conclusion is twofold.
* The choice of doung the guard at the binding is not enough and the
spec is well thought out for redo-safe-variables but not redo safe
parameters. The reason is that the most effective way of storing
the states is to keep a memory tree of the states and make sure not
to keep duplicates in memory which would be the case if we stored a
set of lists. Essentially you would use it like
(let ((a 1))
(any (with-redo-variables ((a 0)) (set~ a 2) P1)
(with-redo-variables ((a 0)) (set~ a 3) P1)
...))
In stead of
(let ((a 1))
(with-redo-variables ((a 0))
(any (all (set~ a 2) P1)
(all (set~ a 3) P2)
...)))
The first is needed in the postpone because we do not backtrack
over the guard when we store the state. Which we will do at a user
interaction use case and there the second form is enough.
Conclusion:
We need to add this postpone use case and decribe it in the spec
and point at it for the rational behind the with-redo-variables
guard. Also we need to change the semantics of redo safe parameters.
** Another optimization is that it is much cheaper to reistate the
same memory the second time e.g. we will reuse what we did
before and hence cons much less. This can have a dramatic effect
on the speed of any-interleave and hence is an important
optimization. But note that the same guard will save a new state
everytime it backtracks which was assumed to be unclean but of any
much high overhead. But in the light of the above optimization it
will hinders the ability to reuse old infromation becase it is a
linked list and it's not possible to exchange one element in the
list. It's better to add a check and the unwind part of the guard
to actually store the state when in that mode e.g. that there is
essentially two types do the abort, in a saving-state, mode, or
keeping the state mode. This way only direct postpones will be
affected but not ordinary uses of any-interleave.
Conclusion: We need to ad a check in the unwind part as well.
/Stefan
next prev parent reply other threads:[~2013-04-13 10:12 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-03 19:36 redo-safe-variables and redo-safe-parameters Stefan Israelsson Tampe
2013-04-13 10:12 ` Stefan Israelsson Tampe [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-04-04 21:13 Stefan Israelsson Tampe
2013-04-01 10:17 Stefan Israelsson Tampe
2013-03-26 17:40 Stefan Israelsson Tampe
2013-03-26 18:05 ` Noah Lavine
2013-03-26 20:43 ` Stefan Israelsson Tampe
2013-03-26 21:07 ` Noah Lavine
[not found] ` <CAGua6m0WyG2_Bk3+b8UDn6ee=mddmmaOPQiF9sJf+jYtE3LsgQ@mail.gmail.com>
2013-03-26 21:38 ` Noah Lavine
2013-03-26 22:01 ` Stefan Israelsson Tampe
2013-03-26 22:36 ` Noah Lavine
2013-03-27 7:13 ` Stefan Israelsson Tampe
2013-03-27 12:42 ` Noah Lavine
2013-03-27 13:22 ` Stefan Israelsson Tampe
2013-03-27 14:29 ` Noah Lavine
2013-03-27 15:04 ` Stefan Israelsson Tampe
2013-03-27 15:29 ` Noah Lavine
2013-03-27 16:15 ` Stefan Israelsson Tampe
2013-03-27 21:44 ` Noah Lavine
2013-03-27 21:46 ` Noah Lavine
2013-03-28 8:36 ` Stefan Israelsson Tampe
2013-03-27 21:37 ` Stefan Israelsson Tampe
2013-03-28 18:03 ` Stefan Israelsson Tampe
2013-03-31 21:16 ` Stefan Israelsson Tampe
2013-04-01 1:23 ` Noah Lavine
2013-04-01 1:37 ` Daniel Hartwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1725031.6ll3YGeLN9@warperdoze \
--to=stefan.itampe@gmail.com \
--cc=guile-devel@gnu.org \
--cc=noah.b.lavine@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).