[plt-scheme] recover a procedure body?

From: Ron Stanonik (stanonik at Cogsci.ucsd.edu)
Date: Wed Oct 2 11:33:52 EDT 2002

On Wed, 25 Sep 2002, Matthew Flatt wrote:
> There's no built-in support for recovering the procedure body or
> arguments.
> 
> If you have control over the context where the procedure is created,
> you can redefine `lambda' to keep that information.
> 
>  ; This example uses v202.2 procedure structures
>  (module new-lambda mzscheme
...
> 
> If you don't have control over that context, then there are lots of
> problems (e.g., the procedure might be implemented in an extension).

Thanks.  That's a beautiful solution.  I've run into a problem and
maybe it's because I don't understand something about context.
new-lamba causes mzscheme and mred to fail with out of memory errors,
if I define a case-lambda.  For example:

[stanonik at duckfeet dynapad]$ mzscheme
Welcome to MzScheme version 202.3, Copyright (c) 1995-2002 PLT
> (load "new-lambda.ss")
> (require new-lambda)
> (define arf (lambda() #t))
> (arf)
#t
> (define arf (case-lambda (() #t) ((x) #f)))
Out of Memory!  Returning NIL!
Segmentation fault

[stanonik at duckfeet dynapad]$ mred -z  
MrEd version 202.3, Copyright (c) 1995-2002 PLT
> (load "new-lambda.ss")
> (require new-lambda)
> (define arf (lambda() #t))
> (arf)
#t
> (define arf (case-lambda (() #t) ((x) #f)))
mred: out of memory

DrScheme, however, doesn't fail.

Thanks,

Ron
stanonik at cogsci.ucsd.edu



Posted on the users mailing list.