Re: [heycam/webidl] Annotations for what may throw (#603)

<sup>+cc @alexcrichton</sup>

@domenic:

> In general I am -1 on Web IDL that duplicates normative prose, and has to be synchronized with it.

The problem is that prose is not machine readable, while Web IDL is, so if the error-throwing-ness of an API is going to be documented anywhere, it seems better if it is in a machine readable form. The reason `[Throws]` would be useful to us (the rust+wasm working group) is for the `web-sys` crate which is programmatically generated from Web IDL.

@bzbarsky:

> There's another problem here. There are various situations (e.g. out of memory or any other resource constraint) that allow any method call to throw at any point and are not really standardized other than being allowed to exist. Whether they can actually throw is implementation-specific.

Yep. We use this information on a best effort basis. We are aware that technically any interaction with JS can throw. It is fine for us to essentially abort on OOM. I think it would be useful to have an attribute for if the spec ever *requires* that an exception is thrown in certain cases (rather than if it *may* throw, which is always true).

--------------------

Overall, this isn't super high priority for us because when wasm gets unwinding, we can use that for most everything.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/603#issuecomment-452043782

Received on Monday, 7 January 2019 19:01:36 UTC