better effects handling for callbacks
This commit is contained in:
parent
44c4b945eb
commit
2d39a18faa
4 changed files with 63 additions and 6 deletions
|
|
@ -15,3 +15,17 @@ createMenuItem(s, "Go to definition...",
|
|||
echo("blah")
|
||||
)
|
||||
|
||||
|
||||
proc noRaise(x: proc()) {.raises: [].} =
|
||||
# unknown call that might raise anything, but valid:
|
||||
x()
|
||||
|
||||
proc doRaise() {.raises: [EIO].} =
|
||||
raise newException(EIO, "IO")
|
||||
|
||||
proc use*() =
|
||||
noRaise(doRaise)
|
||||
# Here the compiler inferes that EIO can be raised.
|
||||
|
||||
|
||||
use()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue