Explain that staticPtrKeys might not yield the keys of dead static pointers.
Needs RevisionPublic

Authored by facundominguez on Sep 8 2017, 5:07 PM.

Details

Reviewers
simonpj
bgamari
hvr
austin
Trac Issues
#14090
Test Plan

./validate

facundominguez created this revision.Sep 8 2017, 5:07 PM
simonpj added inline comments.Sep 9 2017, 8:25 AM
libraries/base/GHC/StaticPtr.hs
119

But we need more! What does "all known keys" mean?

Maybe you mean "a list of all the keys that can be encountered in an execution of this program"? (This specification clearly allows you to drop dead code!) It would be better to tighen up what "encountered" means.

What happens if you call this function in a template haskell splice? Or should you not do that?

bgamari requested changes to this revision.Sep 13 2017, 11:19 AM

Requesting changes due to the same reasons @simonpj brought up.

This revision now requires changes to proceed.Sep 13 2017, 11:19 AM
libraries/base/GHC/StaticPtr.hs
119

Maybe you mean "a list of all the keys that can be encountered in an execution of this program"?

Static pointers may be present even if not evaluated by a particular execution. A more succinct description could be: the keys of the static pointers in the Static Pointer Table. Which steers us into explaining what the contents of the static pointer table are at a given point of the program.

What happens if you call this function in a template haskell splice? Or should you not do that?

It will yield the keys of the static pointer table of GHC, which I presume to be empty, plus the static pointers of any loaded packages. The contents of the static pointer table change every time a package with static pointers is loaded or unloaded.

libraries/base/GHC/StaticPtr.hs
119

The contents of the static pointer table change every time a package with static pointers is loaded or unloaded.

Perhaps we should try to fix https://ghc.haskell.org/trac/ghc/ticket/12875 so there are no exceptions.

bgamari added inline comments.Sep 19 2017, 10:58 AM
libraries/base/GHC/StaticPtr.hs
119

Yes, I agree; fixing Trac #12875 would greatly simplify the story here.

austin resigned from this revision.Nov 9 2017, 5:38 PM