prql
prql copied to clipboard
Prune syntax of string literals, add d-strings and block strings
This is a followup for https://github.com/PRQL/prql/pull/3679#issuecomment-1763486217
At the moment, we have a lot of ways to specify plain string literals (not including s-strings or f-strings). Being a new language without many backward compatibility guarantees issued, I think we can cut some of those out.
As there is quite a few specific proposals here, I suggest we use this issue as the overview and talk about specific syntax in the separate threads. Not all are created yet, feel free to open up a new one.
All proposals at the moment are:
- remove
'for quoting string (reason: unnecessary) - remove multiple-line strings (reason: they make lexer non-modular)
- remove multiple-quote strings (reason: they make lexer non-modular)
- add block strings #3783
- add d-strings
I do think that we should add either of block strings or d-string, but not both, since they provide very similar functionality.
Not a full reply, but:
remove
'for quoting string (reason: unnecessary)
I'm up for this iff we can find a way of representing inner " without escaping. Rust does this successfully with r#" as an example. Otherwise the escapes can become ugly and difficult...
Can you describe what "modular" means in the following?
remove multiple-line strings (reason: they make lexer non-modular)
Why is this such a big problem?
remove multiple-line strings (reason: they make lexer non-modular)
Why is this such a big problem?
I've written a bit about that here: https://github.com/PRQL/prql/issues/3783#issuecomment-1806048866
One quick thought against removing ' quoted string literals: my SQL-inertia leads me to prefer ' over " when writing PRQL string literals because I've been conditioned by the fact that the two different quoting styles mean something completely different. Sure, it's just a matter of retraining, but I always appreciate when a language will graciously accept both common quoting styles without complaint.