-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
constructors that return result<>
#1114
Comments
Thanks for the report! This might be best discussed upstream since that's what governs the design of WIT itself rather than this repository, but in the meantime the main rationale for this is that many languages with native constructor support (e.g. JS and C++) can't support this which is why it's not supported. The alternative is a |
I will close and re-open upstream. Thanks!
I think that is orthogonal since neither JS jor C++ support |
Oh dear, sorry I realize I didn't fully read over your initial posting here which already explained everything I said. Sorry about that! |
No worries at all :) thanks for considering! |
Today, the following syntax is illegal:
Since constructors have no return types. However, this is a perfectly valid use case for languages like TypeScript, as
result<>
return type are lowered intoblob
directly, using exceptions to propagateerror-type
values if they occur. Without it, APIs are forced to use alternative method names likeblob::create()
, which is not standard, and hurts readability/discoverability.Thoughts? I wonder if it is possible to enable this use case..
The text was updated successfully, but these errors were encountered: