I'm sympathetic to the #regex(...)
syntax, but you and the proposal both do a good job IMO of outlining why it's probably not desirable. However, I think you've glossed over what I consider the best alternative—one whose benefits are already thoroughly discussed in the proposal: allow for the extended literals #/.../#
, ##/.../##
, etc., with no bare version.
In addition to allowing unescaped forward slashes (and unescaped /#
, /##
, etc. at deeper levels of nesting), I think the use of #
offers a great indicator of "literal." It's not universal as you note, but it's heavily precedented throughout the language. In addition to #selector
we have #colorLiteral
, #imageLiteral
, #keyPath
, #file
and friends... I personally have a strong mental association between "#
" and "literal" when reading swift.
I still don't believe the proposal does a great job justifying why we need the super-terse bare form to be introduced at the same time as the extended literals.