From: Christophe Raffalli <Christophe.Raffalli@univ-savoie.fr>
To: "Sumlssillo, David" <sussillo@ftintl.com>, caml-list@inria.fr
Subject: Re: callcc/throw...
Date: Tue, 02 Mar 1999 14:06:32 +0100 [thread overview]
Message-ID: <36DBE258.E34BC8C8@univ-savoie.fr> (raw)
In-Reply-To: <36DACA20@smtp.ftintl.com>
If you really need callcc/throw (that is try ... with ... is not enough), this
means you are implementing an algorithm which is bactracking. callcc needs to
save the current stack. this is not very hard as you can copy only the first
page of the stack and delay the other copy when needed. However this keeps a
lot of pointer and will often leads to a lot of memory leaks.
Indeed the stack may contains value that are not related to your backtracking
or that could be recomputed easely.
It is often better (not always) to directly implement your algorithm with the
bactracking explicit (that is keeping a stack of state from which you can
backtrack).
The code is often more difficult to write (you are doing a CPS translation by
hand) but you can gain a lot by
- keeping only what is needed in the state
- not keeping the state from which you know you do not need to backtrack
(most of the time you have a lot of these which are preserved in the stack if
you use callcc)
Christophe Raffalli
prev parent reply other threads:[~1999-03-02 17:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-01 17:04 callcc/throw Sussillo, David
1999-03-02 13:06 ` Christophe Raffalli [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=36DBE258.E34BC8C8@univ-savoie.fr \
--to=christophe.raffalli@univ-savoie.fr \
--cc=caml-list@inria.fr \
--cc=sussillo@ftintl.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