[racket] at-exp: is there any way to make it turn @list{A @"string" escape} into (list "A " "string" " escape") ?

From: Alexander D. Knauth (alexander at knauth.org)
Date: Mon Dec 29 22:25:19 EST 2014

On Dec 29, 2014, at 9:36 PM, Eli Barzilay <eli at barzilay.org> wrote:

> On Tue, Dec 30, 2014 at 3:24 AM, Alexander D. Knauth
> <alexander at knauth.org> wrote:
>> That's part of it, but I also want to be able to have string arguments
>> print as values with the ""s, and also be able to do stuff like:
>> @my-format{some stuff
>>           <~a,~a>@|(foo-x blah) (foo-y blah)|
>>           more stuff}
>> Where the place-fillers can be on the same line as the place-holders,
>> even with a multi-line format string.
> That's a very different problem, I only mentioned it as a side-issue.
> In fact, such uses make the newline problem much more likely to happen,
> since if you see the above work you're more likely to try things like:
>    @my-format{some stuff
>               <~a: ~a,
>                    ~a>@|(foo-name blah) (foo-x blah) (foo-y blah)|
>               more stuff}

In this case, it would first give a warning about the place-fillers not being on
the same line as the place-holders, (and showing the newline and the “      ~a>”)
and then it would give a match error about the result of (foo-y blah) not being a
format string.

I think it’s good to be able to have the place-fillers on the same line as the
place-holders, and if people forget and do something like that, the get a warning,
probably followed by an error, that reminds them to put it on the same line, and if
someone uses it enough and is confident they won’t forget that, they can set that
parameter to turn off the warnings.

But also I like how I can combine the format-like features of having
@my-format{<~a,~a>@|(foo-x blah) (foo-y blah)|}
and having it print things like images syntax-objects properly (when it’s printing it)
with having the place-fillers on the same line
(and possibly but not necessarily right there) with the place-holders.  

You’re saying that it’s a bad idea to combine those sets of features, but given what
you have said so far, I can’t really see what’s so fragile about it.  

> But in any case, it's really best to deal with this separately.  I've
> tried a few things in the past, but nothing was too appealing, at least
> not more than the usual options:
>    @my-format{some stuff
>               @format["<~a,~a>" (foo-x blah) (foo-y blah)]
>               more stuff}
>    (define (xy p) (format "<~a,~a>" (foo-x p) (foo-y p)))
>    @my-format{some stuff
>               @xy[blah]
>               more stuff}
> (And in your case you'd replace `format' with something that does
> something similar to the above semi-trick.)
> -- 
>          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.