[swift-evolution] URL Literals

David Sweeris davesweeris at mac.com
Mon Dec 19 13:36:44 CST 2016


> On Dec 19, 2016, at 11:21 AM, Erica Sadun via swift-evolution <swift-evolution at swift.org> wrote:
> 
> ```swift
> let x = #imageLiteral(resourceName:"nothere.jpg")
> print(x)
> ```
> 
> This compiles. It crashes at runtime. I don't see why URLs should be any different.
> 
> — E

They shouldn’t be. The print function can already handle things that aren’t `CustomStringConvertible`:
struct Foo {}
let x = Foo()
Foo.self is CustomStringConvertible //says `false`
print(x) //says `"Foo()\n"`
so, IMHO, that’s a bug.

- Dave Sweeris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161219/cfcc1251/attachment.html>


More information about the swift-evolution mailing list