nim-chronos/chronos/internal
Jacek Sieka f56d286687
introduce `asyncraises` to core future utilities (#454)
* introduce `asyncraises` to core future utilities

Similar to the introduction of `raises` into a codebase, `asyncraises`
needs to be introduced gradually across all functionality before
deriving benefit.

This is a first introduction along with utilities to manage raises lists
and transform them at compile time.

Several scenarios ensue:

* for trivial cases, adding `asyncraises` is enough and the framework
deduces the rest
* some functions "add" new asyncraises (similar to what `raise` does in
"normal" code) - for example `wait` may raise all exceptions of the
future passed to it and additionally a few of its own - this requires
extending the raises list
* som functions "remove" raises (similar to what `try/except` does) such
as `nocancel` with blocks cancellations and therefore reduce the raising
set

Both of the above cases are currently handled by a macro, but depending
on the situation lead to code organisation issues around return types
and pragma limitations - in particular, to keep `asyncraises`
backwards-compatibility, some code needs to exist in two versions which
somewhat complicates the implementation.

* add `asyncraises` versions for several `asyncfutures` utilities
* when assigning exceptions to a `Future` via `fail`, check at compile
time if possible and at runtime if not that the exception matches
constraints
* fix `waitFor` comments
* move async raises to separate module, implement `or`
2023-10-24 16:21:07 +02:00
..
asyncengine.nim Introduce chronos/internals, move some code (#453) 2023-10-17 20:25:25 +02:00
asyncfutures.nim introduce `asyncraises` to core future utilities (#454) 2023-10-24 16:21:07 +02:00
asyncmacro.nim introduce `asyncraises` to core future utilities (#454) 2023-10-24 16:21:07 +02:00
errors.nim Introduce chronos/internals, move some code (#453) 2023-10-17 20:25:25 +02:00
raisesfutures.nim introduce `asyncraises` to core future utilities (#454) 2023-10-24 16:21:07 +02:00