-
Notifications
You must be signed in to change notification settings - Fork 98
Description
Evidently there's been a discussion about this in clojure (almost 6 years ago) but there wasn't an issue for this in the edn spec so here's one.
So far the only syntax for strings is with speech marks " as delimiters. This makes writing strings that contain " a chore because you have to escape them at every occurrence. It also makes it harder to tell where one argument begins and another ends because no white space is needed to separate arguments.
(
;; needs escaping
{:cmd "echo \"foo ${bar}\""}
;; There's three values in the map below, but can you tell where the second
;; one finishes?
{:cmd "foo bar \"baz\"""\"bag\" bam boom"}
;; What if the string ends up spanning multiple lines?
{:cmd "conf_file=\"c:/tools/msys64/msys2_shell.cmd\"
if ! [ -f \"$conf_file\" ]; then
echo 'failed to set PATH inheritance, conf file doesn't exist' >&2
exit 1
fi
sed -i -e 's/rem \\(set MSYS2_PATH_TYPE=inherit\\)/\\1/' \"$conf_file\""}
)Suffice it to say escaping quotes hurts readability when quotes are used in abundance. This also affects JSON. I recently started using edn to configure my dotfiles so I've been writing quite a bit of shell script in edn and this is the sort of stuff I keep having to deal with.
The discussion I've linked to above described 3 alternatives, hopefully this issue opens a dialogue and gets the ball rolling on how best to tackles this problem.
Personally I quite like the triple quote python approach.