# RFC: Non-standard string literals should be quotable

**URL:** <https://discourse.julialang.org/t/rfc-non-standard-string-literals-should-be-quotable/101460>\
**Category:** Internals & Design\
**Created:** [July 10, 2023, 11:06pm UTC](https://discourse.julialang.org/t/rfc-non-standard-string-literals-should-be-quotable/101460 "2023-07-10T23:06:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![savq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/savq/32/22063_2.png) [@savq](https://discourse.julialang.org/u/savq)\
**Post date:** [July 10, 2023, 11:06pm UTC](https://discourse.julialang.org/t/rfc-non-standard-string-literals-should-be-quotable/101460/1 "2023-07-10T23:06:19Z")

</div>

While working on [tree-sitter-julia](https://github.com/tree-sitter/tree-sitter-julia), I’ve found some inconsistencies in the way Julia treats non-standard string literals versus similar syntactic forms of the language.

In Julia, you can quote identifiers, literals and even macro calls:

```julia-repl
julia> :symbol
:symbol

julia> :"my string"
"my string"

julia> :@mac a b
:(#= REPL[3]:1 =# @mac a b)

julia> :@mac(a, b)
:(#= REPL[4]:1 =# @mac a b)

```

However, you cannot quote non-standard string literals:

```julia-repl
julia> :r"foo+"
ERROR: syntax: extra token """ after end of expression
Stacktrace:
 [1] top-level scope
   @ none:1

```

There doesn’t seem to be any practical reason to forbid this form, and it’s simpler for declarative parsers (like tree-sitter and lezer) to treat it as valid. I want to bring up this issue because I found a couple of examples that suggest it should be allowed.

1. There’s only one scenario where allowing this quoting would be a breaking change. If you pass a “quoted non-standard string literal” as a macro call argument, you get:

2. the parser built-in `var` _can_ be quoted:

The _expected behavior_ should be to parse the quotation as if there were parentheses surrounding the string:

```julia
(future julia)> :r"foo+"i == :(r"foo+"i)

```

These are edge cases of the flisp parser implementation that I haven’t seen mentioned in the [JuliaSyntax.jl Design Discussion](https://julialang.github.io/JuliaSyntax.jl/dev/design/#Flisp-parser-bugs). It’d be better to fix this, instead of letting it become another item on the list.

This change wouldn’t be disruptive at all, even considering it might be a breaking change. In turn it would make the language more consistent.

I’m opening this thread hoping to discuss this proposal. If this change were to be accepted, I’d be interested in implementing it myself in JuliaSyntax.jl, and I’d also need some help to implement it in the flisp parser.
