unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Rob Browning <rlb@defaultvalue.org>
Cc: guile-devel@gnu.org
Subject: Re: memoization and conditional defines
Date: Sat, 09 Nov 2002 11:08:08 -0600	[thread overview]
Message-ID: <87el9usmbr.fsf@raven.i.defaultvalue.org> (raw)
In-Reply-To: <Pine.GSO.4.05.10211090930520.22059-100000@sallust.ida.ing.tu-bs.de> (Dirk Herrmann's message of "Sat, 9 Nov 2002 10:00:49 +0100 (CET)")

Dirk Herrmann <dirk@sallust.ida.ing.tu-bs.de> writes:

> On-the-fly memoization is what guile currently does.  This does,
> however, slow down evaluation, it complicates the evaluator and it
> does not allow us to write out pre-compiled code in order to speed
> up startup time.

OK, that's pretty much what I expected.

> It took me quite some time to understand the issues involved with
> conditional definitions.  My current effort to separate memoization
> and execution made it clearer to me, because it reflects itself in
> the code for the evaluator if you want to do things right.  This
> made me see one thing: The design decisions hidden in R5RS are
> typically based on very thorough investigations of potential
> problems.  Implementations have to be very careful to deviate from
> these decisions.

No argument here.  That's my default assumption as well.

> the cond-expression should be memoized.  However, for eval it is IMO 
> easier to communicate the problems involved when distinguishing
> compilation and interpretation:  When using eval, people typically
> understand that the evaluated expression can not be pre-compiled.  In
> contrast, conditional definitions seem so natural that people will
> probably not be aware of the problems that are involved.

Agreed.  I'd definitely like to err on the side of making complicated
things clearer, so I'd favor making eval explicit as you suggest, and
(as I've probably said elsewhere) I'd definitely like to avoid
clevernesses or conveniences that make it harder know when you're
writing code that can be optimized.

> It should be noted that internal definitions may also only occur at a
> restricted set of places.  For example, even the current guile (which
> allows conditional defines on the top level) does not support the
> following:
>   (lambda foo
>     (if <condition> (define <foo> <bar>)))

Ahh, that's what was confusing me.  I took your "let's are ok" too
broadly and I was wondering why

  (let ()
    (if <condition> (define => #t))
    (cond (#t => 'ok)))

would be fine.  Since that's not fine, I'm not confused :>

Thanks for the explanations.

-- 
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  parent reply	other threads:[~2002-11-09 17:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-07 17:52 memoization and conditional defines Dirk Herrmann
2002-11-07 19:08 ` Bruce Korb
2002-11-07 20:54   ` Clinton Ebadi
2002-11-07 23:22   ` Lynn Winebarger
2002-11-08  0:46     ` Bruce Korb
2002-11-08  1:24       ` Lynn Winebarger
2002-11-09  8:19         ` Dirk Herrmann
2002-11-09 22:39           ` Bruce Korb
2002-11-08  3:11 ` Rob Browning
2002-11-09  9:00   ` Dirk Herrmann
2002-11-09  9:41     ` tomas
2002-11-09 17:08     ` Rob Browning [this message]
2002-11-17 20:41 ` Marius Vollmer
2002-11-17 21:42   ` Bruce Korb

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=87el9usmbr.fsf@raven.i.defaultvalue.org \
    --to=rlb@defaultvalue.org \
    --cc=guile-devel@gnu.org \
    /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).