unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: Mikael Djurfeldt <mikael@djurfeldt.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: Proposal for a new (ice-9 history)
Date: Mon, 29 Oct 2018 20:25:40 -0400	[thread overview]
Message-ID: <87lg6gmg9s.fsf@netris.org> (raw)
In-Reply-To: <CAA2Xvw+Br-Gf_asEjpq3BU3dYzuPoRfn5Cm9F1JKXP=0T5=tGg@mail.gmail.com> (Mikael Djurfeldt's message of "Mon, 29 Oct 2018 15:13:20 +0100")

Mikael Djurfeldt <mikael@djurfeldt.com> writes:

> The interface of (value-history) would instead have a lazy-binder
> which provides a syntax transformer for every $... actually being
> used. The $... identifier would expand into a list-ref into the value
> history.

A few more suggestions:

If I write (define (foo x) (+ $$0 x)) at the repl, then I expect 'foo'
to continue to refer to the same entry in the value history, even after
the value history is later extended.

I'm also a bit concerned about the efficiency implications of expanding
these variable references into 'list-ref' calls when the history grows
large.  If I write a loop that evaluates $$0 a million times, I'd prefer
to avoid a million 'list-ref' calls.

To address these concerns, I'd like to suggest a slightly different
approach:

* $0, $1, ... would continue to be ordinary variable bindings in
  (value-history), as they are now.

* The 'count' in 'save-value-history' would be made into a top-level
  variable in (ice-9 history).

* $$0, $$1, $$2, ... would be handled by a lazy-binder, providing a
  syntax transformer that looks at the value of 'count' at macro
  expansion time, and expands into the appropriate variable
  reference $N.

For example, if $5 is the most recent value, $$0 would expand into $5
instead of (list-ref ...).  This would eliminate my concerns over
efficiency.

What do you think?

      Mark



  parent reply	other threads:[~2018-10-30  0:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29 14:13 Proposal for a new (ice-9 history) Mikael Djurfeldt
2018-10-29 23:54 ` Mark H Weaver
2018-10-30  0:55   ` Mikael Djurfeldt
2018-10-30 10:21     ` REPL and load deifferences (was Re: Proposal for a new (ice-9 history)) Mikael Djurfeldt
2018-10-30 12:20       ` Mikael Djurfeldt
2018-10-30 18:01         ` Göran Weinholt
2018-10-30  0:25 ` Mark H Weaver [this message]
2018-10-30  1:08   ` Proposal for a new (ice-9 history) Mikael Djurfeldt
2018-10-30  6:20     ` Mark H Weaver
2018-10-30 13:59       ` Mikael Djurfeldt
2018-10-31 16:49         ` Mikael Djurfeldt
2018-11-02 13:35           ` Mikael Djurfeldt
2018-11-02 14:02             ` Mikael Djurfeldt

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=87lg6gmg9s.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=guile-devel@gnu.org \
    --cc=mikael@djurfeldt.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).