[swift-dev] Brackets as part of typ names / compiler messages

Tino Heth 2th at gmx.de
Fri Dec 18 04:09:44 CST 2015


I hope that Swift 4.0 will have enough template-like syntax to build something like a generic matrix that can be used in a typesafe way, but in the meantime, I wanted to harness the power of unicode to create "class Matrix«4×4»", which really confused the compiler.
"class Vector🐸" is no problem (still have to find a usecase for it, though :), so I wonder about the rationale for disallowing certain characters in names:
I really hope that nothing outside the standard ASCII range is reserved for future use ;-), but an error like "use of character x is forbidden as part of…" imho should be the response.
I guess the reason for the restriction is a harsh countermeasure against funny jokes with similar looking characters, but I'm curious wether this theory is actually true.

Tino


More information about the swift-dev mailing list