[racket] let-one unused? field

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Aug 24 19:56:02 EDT 2010

At Tue, 24 Aug 2010 17:19:46 -0400, Danny Yoo wrote:
> I've been upgrading some of my programs from 4.2.5 to 5.0.1; I'm
> looking at changes to the output of compiler/zo-parse, and I see that
> a new field has been added to the let-one called 'unused?'.  In what
> situation would 'unused?' be true?

It's for a case like this one:

 (define (f g)
   (let ([y (g)])
     g))

The binding `y' isn't used, so it can go away. To be consistent with
the original program, though, a run-time check will be needed ensure
that `(g)' returns a single value. The check is implemented by using
the `let-one' bytecode form, but the binding is marked as "unused" as a
hint to the JIT compiler.



Posted on the users mailing list.