You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today quoted strings do not allow substitutions to keep full compatibility with JSON. Triple double-quoted strings also don't allow substitutions, even if there is no JSON-compatibility which could be broken.
If you want substitutions in multi-line strings, you would have to do something like
config.longtext="""first line
more lines...
line with """${value1}""" and """${value2}""".
more text with tab
""""
This is a little bit cumbersome. Therefore I propose these solutions:
a configuration option which changes the behavior of """
a new quote $"""..."""
a new quote $"...", which would also allow multi-line strings
In addition to substitution the default backslash-escapes should be interpreted.
Another feature to think about are improved indentation rules, where the indentation of the first line after the first line break is considered to be the zero indentation. The very first line would be ignored, if it was empty. For all lines after the first line break, the common prefix between the current and first line would be removed. This would work for spaces and tabs, but may not have the desired effect for mixed tabs and spaces. If you have those, the first line after the first line break should start at column one.
This would allow:
config {
longtext=$"""
first line
more lines...
line with ${value1} and ${value2}.
more text with\ttab
""""
}
to be the same as above, albeit more readable.
If that is too much magic, there is still the original """.
The text was updated successfully, but these errors were encountered:
Just saw, that this is more or less a duplicate of #391. Havoc's suggestion was to use the backtick, as it is used in ES6. This syntax allows multiline and substitutions. I would not allow general expressions, as HOCON is no programming language.
An addition would be using three backticks similar to three double quotes, which will also use the indentation rules.
chezou
added a commit
to chezou/cloudera-sparklyr
that referenced
this issue
Mar 7, 2017
Today quoted strings do not allow substitutions to keep full compatibility with JSON. Triple double-quoted strings also don't allow substitutions, even if there is no JSON-compatibility which could be broken.
If you want substitutions in multi-line strings, you would have to do something like
This is a little bit cumbersome. Therefore I propose these solutions:
"""
$"""..."""
$"..."
, which would also allow multi-line stringsIn addition to substitution the default backslash-escapes should be interpreted.
Another feature to think about are improved indentation rules, where the indentation of the first line after the first line break is considered to be the zero indentation. The very first line would be ignored, if it was empty. For all lines after the first line break, the common prefix between the current and first line would be removed. This would work for spaces and tabs, but may not have the desired effect for mixed tabs and spaces. If you have those, the first line after the first line break should start at column one.
This would allow:
to be the same as above, albeit more readable.
If that is too much magic, there is still the original
"""
.The text was updated successfully, but these errors were encountered: