[swift-users] Parameter Validation
jens at mooseyard.com
Mon Dec 7 10:30:47 CST 2015
> On Dec 6, 2015, at 11:49 PM, David Hart via swift-users <swift-users at swift.org> wrote:
> I’m looking at the special case of library code. If I surface an API in a library, it’s the library user who will call this function. Would you regard this as an assert or throws scenario?
Assert. It’s not library vs. non-library, it’s a question of bug vs. legitimate runtime error. Passing an invalid parameter value is a bug.
For example, Foundation is a library, and passing an invalid parameter to a Foundation method triggers an assertion failure.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-users