[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] About the behavior of continuation in top-level begin form

Yes, you're right. I am trying to write&test various examples to fully understand what continuation is.

I believe that Racket authors didn't intentionally be special at the beginning.
I humbly think that if the standard make this point more clear, just like the behavior in lambda/let, there will be less useless&confusing difference. Why not?

2013/4/18 Jim Rees <jimreesma@x>
Correct me if I'm mistaken, but I am assuming your "source code" was typed at a REPL when you did your test with racket & others.   I believe the issue at hand then, is REPL internals.

After thinking about this a lot, I agree with you that Racket is simply doing it wrong.    Their claim that they're just splicing the begin form does not excuse the fact that they're drastically mutating the meaning of the continuation during the first pass.

If (begin 1 2 3) printed 1, 2, and 3, then at least I would understand that they were splicing the forms into separate repl passes -- that typing (begin 1 2 3) was the same as typing 1, 2, and 3 on separate lines -- I'd almost buy that.   But they're not printing all 3 items, so the claim is inconsistent.

They're Racket, not Scheme, so there's no point in pressing the matter -- but they're still wrong.

On Wed, Apr 17, 2013 at 4:03 PM, 張書瀚 <zrqsmcx@x> wrote:
Thanks, Jim! Actually, I already know that. 
I tried to put these expressions in let, lambda ... , and in these situations, there's no ambiguity.
But the problem of begin, as I said before, is still there. 
I don't think it's good to deliberately leave that behavior unspecified in the standard, so I post it here (for me, it creates unnecessary misunderstandings).
so, what do think of it ;D ?

2013/4/18 Jim Rees <jimreesma@x>

If you want a more predictable effect, do this instead:

(define cc #f)
(define (f) (call/cc (lambda (k) (set! cc k))) (display "Will you catch me?\n"))

On Wed, Apr 17, 2013 at 12:56 PM, 張書瀚 <zrqsmcx@x> wrote:
Here is the bug-report link. In that post I use a more redundant example, but the idea is the same.

And here is the mails: 

[Me to Matthew Flatt]
  Thanks for your answer! But I am more confused: 
  1 Both the newest version of Chez/Ypsilon Scheme give [Do you catch me?] output. 
  2 Both of them claim that their implementation confirm to the newest r6rs standard.
  3 Are they all wrong? Or is Racket intend not to compatible with r6rs in this point(If the answer is 'yes', what're the benefits)?

[Matthew Flatt to Me]
  I don't think that R6RS is clear on the point of splicing `begin's or
on the continuation of a module body. Even within what is specified,
it's possible that Racket's R6RS implementation doesn't handle `begin'
spliciing according to the standard.

Meanwhile, as you say, `racket' is a different language, and we've
chosen a simpler and more consistent rule for `begin' splicing (i.e.,
always splice). The `racket' language also takes advantage of prompts
to enable local reasoning about continuations in a module (i.e., you
don't have to wonder about the continuation of a module body's
evaluation, which is difficult to specify).

2013/4/18 張書瀚 <zrqsmcx@x>
Hi everyone! 

Here is the source code:

(define cc #f)
(begin (call/cc (lambda(k) (set! cc k))) (display "Will you catch me?\n"))

In newest Racket, (cc) => nothing
In newest Chez/Ypsilon (cc) => Will you catch me?\n

I asked an expert about this, and he said that Chez/Ypsilon is right.

Then I post a bug report to Racket, Matthew Flatt said 
[R6RS isn't clear on the point of splicing `begin's or 
on the continuation of a module body.]

Then I checked r7rs-small-draft-9, I believe there is some ambiguity here.
What do you think about this problem? 
Actually I am a Scheme newbie, I apologize if this problem doesn't make any sense.

Scheme-reports mailing list

Scheme-reports mailing list