From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
To: Daniel Hartwig <mandyke@gmail.com>
Cc: 14039@debbugs.gnu.org
Subject: bug#14039: Bug in with-fluids semantics
Date: Sat, 23 Mar 2013 18:58:05 +0100 [thread overview]
Message-ID: <CAGua6m0bs59hsL_TKcxCk2GF=0Yq8_FzwSW_CBfMUdZRpMTSxg@mail.gmail.com> (raw)
In-Reply-To: <CAN3veReOYFjBRGq2-ZQFuUEL=qULjKtuHhBO+AX2EiB2z+9uXQ@mail.gmail.com>
Ok, I've been meditating over this question and really I can't find a
single use case where the
current behavior is prefered with an optimized path and the more
natural behavior
where undo and redo works is dismissed as a faulty semantics with a
slow path. But not only this if my
suggested change to the VM op semantics is implemented we could
probably add a function
via the C wrapper framework to to the other half of the swap in order
to keep the current semantics.
Then we can force those who uses this semantics to change there code
to include the old behavior if they
wish. Or we might take the defensive route to do the otehr way around.
WDYT, can you find a use case where the current behavir is prefered?
/Stefan
On Sat, Mar 23, 2013 at 3:51 PM, Daniel Hartwig <mandyke@gmail.com> wrote:
> On 23 March 2013 18:41, Stefan Israelsson Tampe <stefan.itampe@gmail.com> wrote:
>> Consider this simple exmple with fluids and reodos via propmts,
>>
>> (define (f x)
>> (let ((s (make-fluid 0)))
>> (with-fluids ((s 0))
>> (let lp ((i 0))
>> (cond ((>= i 100) (fluid-ref s))
>> ((= i 50) (abort-to-prompt 'tag) (lp (+ i 1)))
>> (else (fluid-set! s (+ (fluid-ref s) i))
>> (lp (+ i 1))))))))
>>
>> (define k (call-with-prompt 'tag (lambda () (f 1)) (lambda (k . l)
>> k)))
>>
>> Then we will get in guile-2.0 pretty resent git version
>> scheme@(guile-user)> (k)
>> $1 = 4900
>> scheme@(guile-user)> (k)
>> $2 = 8575
>>
>
> What values do you expect from successive calls to K?
>
>> The reason is that when the with-fluid returns normally it does a full
>> swap. It should only do half a swap e.g. restore the old value of the
>> fluid and not store the current which is of non use because it can not
>> be reached anymore and it contaminates the continuation k.
>
> K captures S, a fluid, along with the dynamic extent. There is only a
> single dynamic extent to which K resumes, and only one value
> associated to the fluid S within that. Subsequent calls to K do not
> generate a new dynamic extent, so it makes sense that modifications to
> the fluids value persist. This example behaives as expected according
> to my understanding of fluids.
>
> Am I missing something?
next prev parent reply other threads:[~2013-03-23 17:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-23 10:41 bug#14039: Bug in with-fluids semantics Stefan Israelsson Tampe
2013-03-23 14:51 ` Daniel Hartwig
2013-03-23 15:41 ` Stefan Israelsson Tampe
2013-03-23 17:58 ` Stefan Israelsson Tampe [this message]
2013-03-23 19:07 ` Andy Wingo
2013-03-23 19:44 ` Stefan Israelsson Tampe
2013-03-24 13:47 ` Stefan Israelsson Tampe
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='CAGua6m0bs59hsL_TKcxCk2GF=0Yq8_FzwSW_CBfMUdZRpMTSxg@mail.gmail.com' \
--to=stefan.itampe@gmail.com \
--cc=14039@debbugs.gnu.org \
--cc=mandyke@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).