Re: Benefit of the effect system?
I wish the effect system could be used to implement sandboxing. The stdlib procs that run system calls could be tagged accordingly, and the application's "main" could then set up a sandbox at runtime to allow only the required system calls.
Re: Benefit of the effect system?
Well, then cast should also have a special effect because it can be used to strip off any pragmas
Re: Benefit of the effect system?
{.pragma: raisesssz, raises: [Defect, MalformedSszError, SszSizeMismatchError].} Run Makes a new pragma called `raisesssz`, which, when used, will imply `raises: [Defect, MalformedSszError, SszSizeMismatchError]`
Re: Benefit of the effect system?
What does the `{.raises:[...].}` pragma at the top of a source file do, as in your ssz_serialization.nim? The manual only describes it as a proc annotation.
Re: Benefit of the effect system?
We use it in our code to: * Enforce noSideEffect (i.e. no access to globals, including stdin/stdout). * Enforce handling of recoverable exceptions and make sure all kinds of exceptions that can be thrown in inner function calls are accounted for or handled or considered irrecoverable: * Serialization [https://github.com/status-im/nim-beacon-chain/blob/db92c2f25/beacon_chain/ssz/ssz_serialization.nim#L4](https://github.com/status-im/nim-beacon-chain/blob/db92c2f25/beacon_chain/ssz/ssz_serialization.nim#L4) * Fuzzing [https://github.com/status-im/nim-beacon-chain/blob/4a2e1806/nfuzz/libnfuzz.nim#L37](https://github.com/status-im/nim-beacon-chain/blob/4a2e1806/nfuzz/libnfuzz.nim#L37) * You can force `{.noSideEffect.}` and `{.gcsafe.}` with a block * [https://github.com/status-im/nim-beacon-chain/blob/4a2e1806/beacon_chain/fork_choice/fork_choice.nim#L161-L166](https://github.com/status-im/nim-beacon-chain/blob/4a2e1806/beacon_chain/fork_choice/fork_choice.nim#L161-L166)