3 ms·
May I introduce to Swift? They even decided on that without any backwards compatibility limitations. It really is not bad, does it really matter if it’s a $ or
by kaba0 3y ago
May I introduce to Swift? They even decided on that without any backwards compatibility limitations. It really is not bad, does it really matter if it’s a $ or a \ ?
- shortrounddev2 3y agousing backslashes for anything other than escaping a characters (e.g: \" or \n) makes it a nightmare to try to coerce the compiler into understanding what you're trying to do if you combine escape characters and syntax in the same string
- kaba0 3y agoYou get a giant ass bracket after it. How is it not readable? “\{a}+\{b}=\{ a + b }\n” Do you also criticize this? “Price: $${price}”?
- shortrounddev2 3y agoTry, for example, generating a regular expression which features backslashes in it. You will get an unreadable mess and probably have to play with it for a while before java will even compile it
- kaba0 3y agoI very hope you are not generating regexes based on user data.. Also, I’m fairly sure $ is a special character in regexes..
- shortrounddev2 3y agoNot all variables are user data
- samus 3y agoA template processor implementing regexes should be used for that situation.
- samus 3y agoThe backslash is actually perfectly appropriate because they are doing more than interpolating strings (even though that's what `STR` is doing). They are also supposed to safely escape the contents of the values.