Opened 4 years ago

Last modified 2 years ago

#11593 new feature request

Template Haskell: Add a way to get names that are neither capturable nor capturing.

Reported by: cgibbard Owned by:
Priority: normal Milestone:
Component: Template Haskell Version: 7.10.3
Keywords: yhjulwwiefzojcbxybbruweejw Cc: cgibbard@…, mgsloan@…, int-index
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


From the documentation on newName: "Although names generated by newName cannot be captured, they can capture other names."

We recently ran into a case where we'd really have liked a way to create a name which can't interact at all with other names in the code, apart from where it is used in the construction of the TH expression.

In this code:

The newName "dynamicQuotedExpressionVariable" used to be simply newName "dyn", and we ended up having occurrences of dyn in the quasiquoted expressions (which would be constructed by NameG) get captured by that newName rather than referring to reflex-dom's definition of dyn.

There ought to be some Q Name action which can be executed to give fresh names which can be used internally by a TH macro without fear that they can be referred to in any way other than using the Name value obtained from the action. The documentation for Name seems to suggest that newName is presently the closest thing, so perhaps we need a new primitive for creating totally-non-interacting Names.

Change History (2)

comment:1 Changed 4 years ago by mgsloan

Cc: mgsloan@… added

comment:2 Changed 2 years ago by int-index

Cc: int-index added
Note: See TracTickets for help on using tickets.