# SE-0243: Codepoint and Character Literals

**URL:** <https://forums.swift.org/t/se-0243-codepoint-and-character-literals/21188>\
**Category:** Proposal Reviews\
**Created:** [March 4, 2019, 3:45pm UTC](https://forums.swift.org/t/se-0243-codepoint-and-character-literals/21188 "2019-03-04T15:45:06Z")\
**Posts on this page:** 1\
**Showing post:** 293

<div class="post-metadata">

**Author:** ![taylorswift](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/taylorswift/32/43413_2.png) [@taylorswift](https://forums.swift.org/u/taylorswift)\
**Post date:** [March 18, 2019, 3:34am UTC](https://forums.swift.org/t/se-0243-codepoint-and-character-literals/21188/293 "2019-03-18T03:34:38Z")

</div>

> [@lorentey](#):
>
> Meh. `Array` vends a trapping subscript on _all_ array values, regardless of context.

This is not a valid comparison. As I’m sure you’re [aware](https://github.com/apple/swift-evolution/blob/master/commonly_proposed.md#strings-characters-and-collection-types) from the perennial “[Array subscript should return optional?](https://forums.swift.org/t/draft-adding-safe-indexing-to-array/10767/3)” pitches here, `Array` vends a trapping subscript because the performance penalty associated with having it return an optional would be unacceptable. This logic doesn’t apply to literals, where performance is an irrelevant concept, since (barring ICU dependencies, which don’t apply at the level we’re talking about) they are a purely compile-time construct.

There are tons of examples in the standard library of APIs which return optionals to the detriment of ergonomics, even when the optional case is a rare edge case. `Unsafe${Mutable}BufferPointer.baseAddress` comes to mind as an example. And I think a buffer pointer with a `count` of `0` is a far less common occurrence than a `Unicode.Scalar` outside of the ASCII range.

---

_[View the full topic](https://forums.swift.org/t/se-0243-codepoint-and-character-literals/21188)._
