r-strings & comments
I started implementing r-strings, partly for https://github.com/prql/prql/issues/376
But ofc one issue: our comments are #.
So
fn test_r_string() {
assert_yaml_snapshot!(parse(r###"
derive x: r#"r-string test"#
"###).unwrap(), @r###"
---
version: ~
dialect: Generic
nodes:
- Pipeline:
- Derive:
- NamedExpr:
name: x
expr:
Ident: r
"### )
}
What do we think about the best syntax to use for comments? # is friendly and used for python (and BigQuery). But I'm not sure there are any intrinsic qualities which mean we need to keep it.
I would say that there are two options: # and //. There is also -- from SQL and Haskel and ' from VB.NET, but they are non-conventional so I would avoid them.
# is used in Python and R, which overlap with our target audience a lot, so that would be a good choice. If we go with that, we cannot use r#" text "# for multiline strings. There is """ text """ from python, which is easier to use, but it has the constraint that you cannot use """ in text, i believe.
Only alterntive is changing comments //, which are more common, but less new-user friendly.
I'm for the python multiline strings.
Yes, good point, and +1 re the target audience.
We could expand it to any number of ", either an odd number or >2, to get to full generality.
I like the python strings too , and # for comments 👍