[racket] quasisyntax vs quasisyntax/loc
Thanks for your answer.
Did i understand it correct that neither quasisyntax nor quasisyntax/loc
recognize quasisyntax/loc inside. So if these are used, quasisyntax/loc
must currently be in the outmost layer?
On Tue, 04 Jun 2013 12:07:39 +0200, Matthew Flatt <mflatt at cs.utah.edu>
wrote:
> The problem is that `quasisyntax' doesn't recognize `quasisyntax/loc'
> as a kind of quasiquote.
>
> In terms of plain quasiquote, your example is analogous to
>
> > (define-syntax-rule (qq e) (quasiquote e))
> > `(qq ,(+ 1 2))
> '(qq 3)
>
> as opposed to
>
> > `(quasiquote ,(+ 1 2))
> '`,(+ 1 2)
>
> A difference is that `quasisyntax/loc' is predefined --- so, in some
> sense, you're not supposed to know that it's a macro, and maybe it
> should just work.
>
> Offhand, I can imagine ways to fix the interaction of `quasisyntax' and
> `quasisyntax/loc', but I'll have to think it more.
>
> At Tue, 4 Jun 2013 11:52:27 +0200, Tobias Hammer wrote:
>> Hi,
>>
>> i have a problem with nested quasisyntax, quasisyntax/loc and unsyntax.
>> Two quasisyntax with one unsyntax gets me one level up, as expected. But
>> two quasisyntax/loc with unsyntax somehow gets me to the outmost level.
>>
>> Can anybody tell me if this is intended or explain why this happens?
>>
>> Tobias
>>
>>
>> ; --- examples
>>
>> (define-syntax (noloc stx)
>> (syntax-case stx ()
>> [(_)
>> (let ([var 'outer])
>> (quasisyntax
>> (let ([var 'inner])
>> (quasisyntax
>> #,var))))]))
>>
>> (noloc)
>> > #<syntax:10:29 outer>
>>
>>
>> (define-syntax (loc stx)
>> (syntax-case stx ()
>> [(_)
>> (let ([var 'outer])
>> (quasisyntax/loc stx
>> (let ([var 'inner])
>> (quasisyntax/loc #'here
>> #,var))))]))
>>
>> (loc)
>> > #<syntax inner>
>>
>>
>>
>> --
>> ---------------------------------------------------------
>> Tobias Hammer
>> DLR / Robotics and Mechatronics Center (RMC)
>> Muenchner Str. 20, D-82234 Wessling
>> Tel.: 08153/28-1487
>> Mail: tobias.hammer at dlr.de
>> ____________________
>> Racket Users list:
>> http://lists.racket-lang.org/users
--
---------------------------------------------------------
Tobias Hammer
DLR / Robotics and Mechatronics Center (RMC)
Muenchner Str. 20, D-82234 Wessling
Tel.: 08153/28-1487
Mail: tobias.hammer at dlr.de