chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Printing procedures returned from call/cc


From: jpn
Subject: Re: [Chicken-users] Printing procedures returned from call/cc
Date: Tue, 31 Jul 2012 20:40:47 -0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Jul 31, 2012 at 11:09:30PM +0200, Felix wrote:
> From: "Jeronimo Pellegrini" <address@hidden>
> Subject: [Chicken-users] Printing procedures returned from call/cc
> Date: Tue, 31 Jul 2012 09:59:44 -0300
> 
> > Hello,
> > 
> > I was wondering why this happens in Chicken (recent checkout from git):
> > 
> > (let ((lst (call/cc (lambda (x)
> >                       (print 'something)
> >                       (call/cc (lambda (y)
> >                                  (list x y)))))))
> >   (print lst)
> >   (print (eq? (car lst) (cadr lst)))
> >   (print (eqv? (car lst) (cadr lst)))
> > 
> > ==>
> > (#<procedure (f_10734 . results1838)> #<procedure (f_10734 . results1838)>)
> > #f
> > #f
> > 
> > The procedures returned are different continuations (and of course
> > they are certainly not eq? or eqv?). So I was wondering, then, why print
> > (and write, etc) show the same names for them. I mean, they were printed
> > from the same list, so in the same lexical context, and they are
> > different... It's a bit confusing that they "look the same" when
> > printed -- they wouldn't look the same if their names were something
> > "generic" like "#<continuation>", but they actually have names that look
> > like something generated by gensym. I'm probably missing something, but
> > can't see exactly what.
> 
> These procedures are internally generated and represent different
> closure records but for the same piece of code. The printer for
> closures will show something that relates to the code, not the
> allocation or identity. The procedure-id shown here is admittedly
> useless, though. 

OK, I see!

> Attached a patch that at least hints at what sort of procedure is
> shown. If you find this in any way useful, I can add it to the
> git repo.

Well, the output certainly more informative with the patch than it
was before!

Thank you!
J.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]