[swift-evolution] A path forward on rationalizing unicode identifiers and operators
clattner at nondot.org
Tue Oct 3 23:51:07 CDT 2017
On Oct 3, 2017, at 5:48 PM, Ethan Tira-Thompson via swift-evolution <swift-evolution at swift.org> wrote:
>> I do think that Ethan’s suggestion upthread interesting, which suggest considering something like:
>> import matrixlib (operators: [ᵀ,·,⊗])
FWIW, I think you should split discussion of this off into a new subthread, because people are probably not paying attention to it buried in this one.
>> Three concerns I see:
>> - Requiring them today would be a source incompatibility with Swift 4
> To clarify, I’m only suggesting the qualifier be required for “non-standard” operators, so the source incompatibility would be on par to whatever unicode cleanup is similarly reclassifying characters already in use.
> In that vein, this suggestion would dovetail well with such a reclassification effort, as it would give an easy upgrade path for existing code that wants to continue using a particular character, and allows a fairly conservative set of “standard” operators to be whitelisted without sacrificing end-user expressibility, which simplifies the scope of the classification effort.
> “Standard” operators could include sections of the mathematical plane even though they aren’t necessarily used by the standard library, if there is desire to reserve such characters exclusively for operators and never identifiers.
I’m not sure how this would work. The people objecting to operators seem to be saying that they don’t know what they do. I’m not sure how to rectify that, but the idea of making it more explicit in code is interesting, and maybe there is a way to tie it in somehow. That’s why I’m saying it is potentially interesting to explore this, even though it isn’t immediately apparent to me how this can help with the concerns.
>> - Imports are per-module, not per-source-file, so this couldn’t be used to “user-partition” the identifier and operator space. It could be a way to make it clear that the user is opting into these explicitly.
> Ahh nuts I actually thought imports were per-source-file! 🤦🏻♂️
Jordan clarified this downthread.
More information about the swift-evolution