[GHC] #11656: Alllow static pointers to local closed definitions
GHC
ghc-devs at haskell.org
Mon Feb 29 17:30:23 UTC 2016
#11656: Alllow static pointers to local closed definitions
-------------------------------------+-------------------------------------
Reporter: mboes | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by facundo.dominguez):
This is the mechanism we were considering so far:
1. Have the renamer compute whether bindings in scope are closed.
2. When the renamer finds a static form, allow the free vars to be top-
level or closed local bindings.
3. Desugar the static form. This produces a list of floated Core bindings.
4. For each such Core binding find the free variables of local
definitions.
5. For each found local definition traverse the enclosing top-level
binding to remove it.
6. Add each removed local definition at the top level.
If it simplifies anything, a variant is to skip (5) and have (6) copy the
local definitions as local definitions of the Core bindings produced in
(3). This might duplicate local definitions once per static form in which
they are used. Does copying definitions like this require also renaming
bindings?
Local definitions may transitively use other local definitions, in which
case all of them should be floated.
We were wondering if we are the first hackers in need of a function in GHC
to determine if bindings are closed or not. Maybe someone could point if
this is computed elsewhere already. We only found a flag {{{tct_closed}}}
which only applies to types, not expressions.
Is floating local definitions to the top-level disruptive for other
compilation stages? We are open to proposals of alternative mechanisms.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11656#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list