Prepitch: Character integer literals

There’s another issue that idk if it’s been resolved, and that’s “removingExpressibleByUnicodeScalarLiteral and ExpressibleByExtendedGraphemeClusterLiteral conformance from String and StaticString. It’s my understanding that these conformances would have to stay in ABI but the typechecker would pick them out and diagnose let s:String = 'a' as an error at compile time,, just wanted to confirm if there are no ABI issues here.

As ExpressibleByStringLiteral inherits from ExpressibleByExtendedGraphemeClusterLiteral which in turn inherits from ExpressibleByUnicodeScalarLiteral there won’t be an ABI stable way to stop let a: String = ‘a’ from working. I don’t see it as a problem. This is the reason ’a’ + ‘b’ == “ab”.

well, i can’t say i’m too comfortable with this, but i guess if you can initialize a Double with an integer literal, it’s fine to initialize a String with a character literal. does kind of blur the "" vs '' distinction we were trying to drill into users’ heads though.

Review underway here: SE-0243: Codepoint and Character Literals

2 Likes