[swift-corelibs-dev] incomplete implementation warning functions

Tony Parker anthony.parker at apple.com
Thu Jan 21 12:04:15 CST 2016


Hi Will,

The reason we chose fatalError() was that we felt that the safest course of action when reaching unimplemented code was to immediately crash. If we continue instead, aren’t we putting the app into an unknown state?

- Tony

> On Jan 21, 2016, at 2:55 AM, Will Stanton via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
> 
> Hello,
> 
> I would like to propose functions that warn about incomplete implementations without calling NSUnimplemented/fatalError. They could provide a standard interface for reminding/warning about incomplete implementations while things are being built.
> 
> I was thinking of two utility functions:
> 1) NSWarnIncompleteImplementation: Prints a warning message once. Can make potential issues clear (without flooding the console), particularly for classes where most of the implementation is there, but something could fail for certain parameters/configurations.
> 2) NSWarnUnimplemented: prints a warning on each call, ex. in a setter that doesn’t do anything
> 
> Something like:
> https://github.com/e78l/swift-corelibs-foundation/commit/f69f174ef0cfcdd32fb43912c2c88179fce07ce3
> 
> Are there are any recommendations/thoughts about incorporating these functions?
> 
> Regards,
> Will Stanton
> 
> _______________________________________________
> swift-corelibs-dev mailing list
> swift-corelibs-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev



More information about the swift-corelibs-dev mailing list