Bug 11348 – Introduce assumeWontThrow for use with nothrow functions

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-24T14:35:00Z
Last change time
2013-10-24T14:38:07Z
Keywords
pull
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2013-10-24T14:35:54Z
The assumeWontThrow function is useful in contexts where a nothrow function might want to call some piece of code which is /not/ marked as nothrow even though it doesn't necessarily throw. If the called function does throw, assumeWontThrow will promote the exception into an AssertError, which is an Error derivative and thus allows to be thrown from nothrow functions. https://github.com/D-Programming-Language/phobos/pull/1571
Comment #1 by andrej.mitrovich — 2013-10-24T14:38:02Z