[GHC] #10047: inconsistency in name binding between splice and quasiquotation

GHC ghc-devs at haskell.org
Thu Jun 4 16:34:30 UTC 2015


#10047: inconsistency in name binding between splice and quasiquotation
-------------------------------------+-------------------------------------
        Reporter:  rwbarton          |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:  7.12.1
       Component:  Template Haskell  |                 Version:  7.8.4
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:  th/T10047
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Reid is, as usual, spot on.  The big deal about quasiquotes is that they
 save you writing `$(wow "blah")`.  It's interesting that the (entirely
 accidental) change in scoping is "one of the main advantages of using
 quasi-quoters".  Can you say why it's so important?

 Quasi-quoters may use anti-quotation:
 {{{
 xs = blah
 [wow| funny language `(reverse xs)` blah |]
 }}}
 Here `wow` might use back-quotes to trigger anti-quotation, and then use
 `reify` to look up `reverse` and `xs`.  So we'd need them to be in scope.

 It's not ridiculous to propose the scoping you want for declaration
 splices; it could be something like
  * bring all the binders into scope (`thing` and `okay` in your example)
  * run the quasi-quote
  * splice it in

 But someone would need to work out the details.  Eg if there were two
 quasiquotes, what would each see in its reification environment.

 Simon

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10047#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list