differential-datalog icon indicating copy to clipboard operation
differential-datalog copied to clipboard

string interpolation with nested quotation marks

Open blp opened this issue 5 years ago • 2 comments

String interpolation in DDlog requires inner quotation marks to be backslashed, like this:

"${foo(\"bar\")}"

Other languages tend to use a different syntax that can avoid the need for the inner backslashes, in which the ${ introduces a new nested lexical context that ends only at } and not at any outer syntax, so that this interpolation could be expressed more naturally as:

"${foo("bar")}"

This would also be more ergonomic in DDlog, in my opinion.

blp avatar Oct 01 '20 23:10 blp

I agree. This change will break existing code, which is annoying, but at least it won't break it silently.

ryzhyk avatar Oct 01 '20 23:10 ryzhyk

Implementation-wise, we currently use parsec's built-in string literal parser. We will have to change this to implement nested expression parsing.

ryzhyk avatar Oct 01 '20 23:10 ryzhyk