by mickael-kerjean · 5y ago · 0 comments
What's the point? I cringe every time a project uses both double quote and single quote, a mix of semicolon and no semicolon and a mix of tabs and space, .... Which one to pick isn't relevant as soon as the code base is consistent
The most practical solution for this problem I saw was in F#. You can use tripple-quoted strings.
let a = """The diner is called "John's", but you can't let the string end with a double quote"""
https://docs.microsoft.com/en-us/dotnet/fsharp/language-refe... "normal string can contain ' "
r#" raw string can contain " ' "#
r###" if for some reason you need to write "# "###
Kinda like heredocs // the object key here is "weird object key '\""
{%{weird object key '":}%:"see how it works?"}
// ditto
{%""{weird object key '":}""%:"see how it works?"}E.g., how would you put the following sentence in a string:
You can use both " and ' to delimit a string.
"You can use both \" and ' to delimit a string"
Or they could pull a YAML, and retroactively redefine what JSON stands for, the way YAML originally stood for "Yet Another Markup Language" until some party pooper pointed out to their great surprise that YAML was not actually a document markup language, but a data serialization language, so they redefined it to mean "YAML Ain't Markup Language" -- the opposite of what it originally meant.
https://en.wikipedia.org/wiki/YAML#History_and_name
https://en.wikipedia.org/wiki/Markup_language
Pro Tip: When naming you file format, look up what the words in your acronym mean, first.