[swift-evolution] Disallowing unreachable code

Alex Blewitt alblue at apple.com
Wed Mar 29 08:06:45 CDT 2017

On 29 Mar 2017, at 11:38, Jonathan Hull via swift-evolution <swift-evolution at swift.org> wrote:
>> On Mar 27, 2017, at 11:27 AM, John McCall via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> In fact, we should probably double-down on this design and add an "unimplemented" expression that always triggers warnings and just traps if you try to evaluate it. That expression would be a logical thing to use in e.g. code snippets automatically inserted by an IDE.
> Yes, please.

You can do this already:

func unimplemented<T>(_ file:String = #file,_ line:Int = #line) -> T {
  fatalError("Not implemented \(file):\(line)")

let f: String = unimplemented()

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170329/bb8a3f77/attachment.html>

More information about the swift-evolution mailing list