Thank you for bringing up the topic of identifiers with non-identifier characters! This is something I've been thinking about for a while, and the use case you describe is a great oneâand probably a better starting sales pitch than what I need it for, so I'm glad you started the discussion instead of me 
The use case I'm most interested in is allowing non-identifier characters in module names. At Google (and other companies using Bazel in a monorepo), a particular app could be made up of tens (or possibly hundreds!) of Swift and Objective-C modules at different paths in the monorepo, owned by various different teams. Each build target has a label of the form //path/to/package:target_name. Since module names cannot collide anywhere in the build graph for an application, we can't rely on teams to choose their own module names because two teams could choose something common like Utility for some internal library. So, we mangle the Bazel target label to turn it into an identifier, and the Swift code has to do:
import path_to_package_target_name
This works, but the mapping is not reversible (to try to keep it as simple and obvious as possible), so there is the potential for collision in rare cases, and there's still some mental load to convert the label (which you already know, because you have to express the dependency in your build file) into the module name.
I would love to allow Bazel users to write this instead:
import `//path/to/package:target_name`
This would have a couple huge benefits:
- There's no mental load to convertâthe module name is the target label, period.
- It's now reversible, which means we can build great tooling around this. Specifically, we can make Swift source files be the source of truth and generate the build files (i.e., the dependency lists) from them, instead of making the user manually write them in two places. We can't do that today unless we maintained a master mapping from module names back to build target labels somewhere.
Now, backticked identifiers doesn't solve my problem completelyâwe'd need an alternate way to pass these modules to the compiler since you can't have a file named //path/to/package:target_name.swiftmodule (well, not easily), but that's a separate driver/frontend issue that I don't think needs to impact this feature.
So, huge +1 to this idea in general, and it should apply uniformly to all identifiers (modules, variables, functions, etc.). Backticks already mean "escape this reserved word that isn't a suitable identifier on its own and make it an identifier", so replacing "reserved word" with "sequence of characters" seems like the exact right thing to do.
I strongly disagree that we should have arbitrary restrictions like these (and not only because it would prevent my use case above). Many programming language features can be abused, but instead, we just trust users to make intelligent, grown-up decisions about their code. With identifiers, you can already do confusing things today:
struct A {}
let a = Î() // error: use of unresolved identifier 'Î'
(Line 1 is Latin uppercase A; line 2 is Greek uppercase Alpha).
And that's not even touching emoji, which Swift has allowed emoji in identifiers since day 1 and we haven't seen an epidemic of users trying to shove those into identifiers, so I think we can trust users here as well. If someone gives identifiers an unusable or confusing name, good solutions include making a lint rule for it or calling it out in a code review, but not crippling the feature arbitrarily and limiting legitimate use cases.
I think raw string literals are a better thing to emulate here, by extending the grammar for backticked identifiers, because it generalizes more nicely than backslash escaping:
func `test foo bar`() {}
func #`test foo`bar`#() {}
func ##`test foo`#bar`##() {}
But these are certainly rare scenarios.
Tools would most likely have to be updated anyway to handle identifiers that contain backticks or non-identifier characters properly, so I don't think we need more rules like that concatenation one. They would just add complexity with little benefit.