-
Notifications
You must be signed in to change notification settings - Fork 82
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
Resource constructor result typing #285
Comments
Great point and thanks for filing! This same issue came up in another context, with the same tentative conclusion, so agreed this is a good thing to add right after Preview 2. I think the change here is just to loosen the validation criteria for |
Static methods also return interface foo {
resource bar {
fallible-ctor: static func() -> result<bar, string>
}
} I think this might be better than allowing |
Sorry, I didn't follow your point regarding static methods,
IIUC, the current prototyped JS bindings for |
Resource types don't currently have the ability to define constructors as having custom result return error types.
For this reason, custom static constructors are likely usually preferable for resources since most constructor patterns with non-trivial arguments will want argument validation.
Would it make sense to consider result overloading only for resource constructors? I believe most languages should come with the ability to return an error from a resource constructor.
The text was updated successfully, but these errors were encountered: