> On Jan 11, 2017, at 3:55 PM, Ben Rimmington <[email protected]> wrote:
>
>
>> On 11 Jan 2017, at 13:16, Charlie Monroe wrote:
>>
>> Instead, I'd personally love better character support in Swift in the future
>> and allow a Character literals using ' - just like in C, except with Unicode
>> support:
>>
>> let myChar = 'x' // Character
>> let myChar2 = '∃' // Character
>> let myChar3 = '\0' // NUL Character
>> let myChar4 = 'xyz' // Error from compiler
>
> This feature was removed (just before the first Swift 1.0 beta). Search for
> "Single-quoted literals are no longer recognized" in the CHANGELOG.
I'm aware of that and think it's a shame. When you need a Character, you either
need to declare the variable with type:
let c: Character = "a"
or use the initializer (which I prefer):
let c = Character("a")
--- but here, this is valid:
let c = Character("ax")
and will compile, yet crash at runtime.
I really hope that special syntax (single-quotes, or any other) is introduced
back in the future.
>
> <https://github.com/apple/swift/blob/master/CHANGELOG.md#2014-05-13>
>
> I'm looking forward to the "String re-evaluation" part of Swift 4 stage 1.
> Hopefully, the Character type will also be improved.
>
> -- Ben
>
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution