[racket] at-exp: is there any way to make it turn @list{A @"string" escape} into (list "A " "string" " escape") ?
> But most of all, IMO it sounds like a bad idea since it tries to fight
> the natural mixed-text-and-expressions and bend it into a
> format-string-like thing. I'd go with something that avoids that and
> uses @-expressions more naturally, as in:
>
> @my-error['f]{message
> given: @~v[stuff]
> other-arguments: @~v[other-stuff]}
I had a similar thought. Actually I have a draft of a blog post
looking at some handy ways to use @-exprs beyond "it's for writing
Scribble". One way is to do what I believe langs like Python and Ruby
refer to as "string interpolation".
Instead of:
(format "x is ~a and y is ~a" x y))
you could write:
@~a{x is @x and y is @y})
With the format style you have to flip between the `~a`s on the left
and the values on the right, making sure they match. How many times
have you gotten them out of sync? Yeah, me too.
Whereas with the @-expr ("string interpolation") style, writing the
values "inline" is arguably easier to write, read, and maintain
correctly.
So if possible it might be nice to have it be @-exprs all the way up,
rather than hiding that goodness below a format-style interface.