4 ms·
Mmmmm...syntactic sugar...
by yepthatsreality 7y ago
Mmmmm...syntactic sugar...
- chrisseaton 7y agoNot sure what you mean? This doesn't add or use any new syntax, let alone syntactic sugar. It's a new builtin method.
- DDR0 7y agoCould you provide an example of what this desugars to? I'm not sure I understand.
- sveingjoby 7y agoYes, you are (of course) able to replace all occurrences today. However, you either need to call replace multiple times or pollute your code with a regex. This would certainly improve the readability.
- pier25 7y agoWhy would using regex pollute your code?
- Normal_gaussian 7y agoIt depends on who you ask; however the thinking is often: * They can indicate poor parsing (ie can't read xml with regex) and failure to use programmatic methods (e.g parsing command output rather than making syscalls) * regexes are very easy to write incorrectly without being obviously wrong * regexes are often overkill for a direct match * regexes invite people to make it more complex rather than restructure surrounding code * regexs are comparatively more expensive than alternative code * to work on the codebase you are now required to understand regex in general and this particular implementations quirks as well I often use regexes, and I often choose not to use regexes.