[racket] Using parameters in register-finalizer

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Oct 17 16:18:41 EDT 2014

At Fri, 17 Oct 2014 15:22:06 -0400, Asumu Takikawa wrote:
> It appears that finalizers for register-finalizer are run in a special
> thread that has an empty thread cell table, but it seems like this makes
> certain parameters like `current-output-port` return #f instead of the
> documented value.
> 
> Is that the expected behavior?

It's not great that contracts are violated, but I think it's justified
on the grounds that `register-finalizer` is in the unsafe world, and a
finalizer procedure should not use any parameter except
`current-logger`.

The documentation's "should generally not rely on the environment of
the triggering thread" should be strengthened to say that all bets are
off if you use a parameter other than `current-logger`.


Posted on the users mailing list.