[plt-scheme] Function names

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Jul 6 09:15:24 EDT 2002

At Sat, 6 Jul 2002 04:12:42 -0400, Eli Barzilay wrote:
>   Welcome to MzScheme version 200, Copyright (c) 1995-2002 PLT
>   > (define (f) (lambda () 1))
>   > (define ff (f))
>   > ff
>   #<procedure:STDIN::13>
> 
> Is there any reason for `define' (and `let') to not always add an
> 'inferred-name property so the name of `ff' would be a more
> informative "#<procedure:ff>"?

'inferred-name is a compile-time property, and in this case there's no
way to predict the name "ff" when compiling the first expression.

It *would* be possible to predict the name within a module, but I doubt
that we'll try to define such a smart name inference.

Meanwhile, the programmer can write

 (define (f) (let ([ff (lambda () 1))])
               ff))

to get the name `ff' if it's important enough.

Matthew




Posted on the users mailing list.