<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 11, 2017, at 3:55 PM, Ben Rimmington <<a href="mailto:me@benrimmington.com" class="">me@benrimmington.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""><blockquote type="cite" class="">On 11 Jan 2017, at 13:16, Charlie Monroe wrote:<br class=""><br class="">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:<br class=""><br class="">let myChar = 'x' // Character<br class="">let myChar2 = '∃' // Character<br class="">let myChar3 = '\0' // NUL Character<br class="">let myChar4 = 'xyz' // Error from compiler<br class=""></blockquote><br class="">This feature was removed (just before the first Swift 1.0 beta). Search for "Single-quoted literals are no longer recognized" in the CHANGELOG.<br class=""></div></div></blockquote><div><br class=""></div><div>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:</div><div><br class=""></div><div>let c: Character = "a"</div><div><br class=""></div><div>or use the initializer (which I prefer):</div><div><br class=""></div><div>let c = Character("a")</div><div><br class=""></div><div>--- but here, this is valid:</div><div><br class=""></div><div><div style="margin: 0px; font-size: 9px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> c = </span><span style="font-variant-ligatures: no-common-ligatures" class="">Character</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"ax"</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">)</span></div><div style="margin: 0px; font-size: 9px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal;" class="">and will compile, yet crash at runtime.</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">I really hope that special syntax (single-quotes, or any other) is introduced back in the future.</div></div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class=""><<a href="https://github.com/apple/swift/blob/master/CHANGELOG.md#2014-05-13" class="">https://github.com/apple/swift/blob/master/CHANGELOG.md#2014-05-13</a>><br class=""><br class="">I'm looking forward to the "String re-evaluation" part of Swift 4 stage 1. Hopefully, the Character type will also be improved.<br class=""><br class="">-- Ben<br class=""><br class=""></div></div></blockquote></div><br class=""></body></html>