From 29927f58fa75bfe7b1ba25a524b51a41878996b3 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Thu, 25 Aug 2022 14:54:02 -0700 Subject: [PATCH] RFC: Prohibit use of interpolated strings in function calls without parentheses (#648) We've had this restriction in the original RFC, but decided to remove it afterwards. This change puts the restriction back - we need to work through some implications of future support for string-based DSLs together with interpolated strings which may or may not change the behavior here, for example to allow something like ``` local fragment = xml ` ` ``` --- docs/syntax-string-interpolation.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/syntax-string-interpolation.md b/docs/syntax-string-interpolation.md index 9f7ae08..2fbb04b 100644 --- a/docs/syntax-string-interpolation.md +++ b/docs/syntax-string-interpolation.md @@ -87,13 +87,15 @@ print(`Welcome to \ -- Luau! ``` -This expression can also come after a `prefixexp`: +We currently *prohibit* using interpolated strings in function calls without parentheses, this is illegal: ``` local name = "world" print`Hello {name}` ``` +> Note: This restriction is likely temporary while we work through string interpolation DSLs, an ability to pass individual components of interpolated strings to a function. + The restriction on `{{` exists solely for the people coming from languages e.g. C#, Rust, or Python which uses `{{` to escape and get the character `{` at runtime. We're also rejecting this at parse time too, since the proper way to escape it is `\{`, so: ```lua