Open thchr opened 4 weeks ago
It's not specific to @lazy_str
:
julia> macro foo_str(s)
show(s)
end
@foo_str (macro with 1 method)
julia> foo"hello \
world"
"hello \\\n world"
Good catch; updated title to reflect this.
There is no line continuation character for string macros, so that title isn't quite right either, as something that doesn't exist cannot be blamed for not working. The main thing this may want is to replace the content of lazy string with the content mangled according to calling str = unescape_string(escape_raw_string(str))
. This is slightly breaking, so we cannot necessarily do it for existing macros, but new ones (e.g. styled""
) implements this transform to follow the user's typical expectations.
Makes sense; feel free to update title to something more precise.
It seems unlikely that relatively recent string macros like lazy""
would incur real breakage for such a change though. On other hand, it probably wouldn't be nice to change raw""
to do this.
The
@lazy_str
macro behaves differently from ordinary strings when using the line continuation character\
:Apart from interpreting the line-continuation character as a "raw" backslash (and consequently also inserting a line-break),
lazy"..."
also doesn't ignore the white-space on the following line. This seems unintended and undesirable.