# Literal initialization via coercion

**URL:** <https://forums.swift.org/t/literal-initialization-via-coercion/11251>\
**Category:** Pitches\
**Created:** [March 22, 2018, 12:41am UTC](https://forums.swift.org/t/literal-initialization-via-coercion/11251 "2018-03-22T00:41:08Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![allevato](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/allevato/32/385_2.png) [@allevato](https://forums.swift.org/u/allevato)\
**Post date:** [March 23, 2018, 4:18am UTC](https://forums.swift.org/t/literal-initialization-via-coercion/11251/9 "2018-03-23T04:18:49Z")

</div>

Thanks for bringing this up! This is one of those parts of Swift that I've wanted to see cleaned up for a while.

It may be a good idea to read up on [John McCall's thread](https://forums.swift.org/t/proposal-t-literal-should-construct-t-using-the-appropriate-literal-protocol-if-possible/2861) from a couple years ago where he brought up the same issue, just to see if there's any valuable discussion about design/implementation. It's a shame this didn't get fixed back then.

You mention the case of `UInt64(0xffff_ffff_ffff_ffff)` becoming valid, as it should. But I would also mention that this turns some expressions that are currently only runtime errors into compiler errors (as they also should be, if the conversion is invalid). For example, `"ab" as Character` is currently a compile-time error but `Character("ab")` compiles and traps at runtime. Having the latter caught at compile time falls nicely out of this change.

---

_[View the full topic](https://forums.swift.org/t/literal-initialization-via-coercion/11251)._
