Skip to content
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

Simplify for optional value types #292

Open
kennykerr opened this issue Jul 29, 2020 · 3 comments
Open

Simplify for optional value types #292

kennykerr opened this issue Jul 29, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@kennykerr
Copy link
Collaborator

WinRT uses IReference<T> parameter and field types to indicate that a given argument/value is optional. This should be expressed in Rust using Option<T>. In particular, we should add Param specializations (as we do for strings) for IReference<T> input parameters to allow parameters to either accept T or None.

This builds on #92.

@kennykerr
Copy link
Collaborator Author

Closing this old issue - doesn't seem to be much demand for such API support. Let me know if you have thoughts to the contrary. 😊

@kennykerr
Copy link
Collaborator Author

Reopening as there's renewed demand for WinRT type system support. Doing what I described here #2310 (comment) should be a little easier with a stock implementation.

@kennykerr kennykerr reopened this Sep 5, 2024
@kennykerr
Copy link
Collaborator Author

I think that IReference<T> support can be limited to "optional" behavior rather than the double mean used by Xaml and .NET for polymorphic value types. That simplifies the implementation and lets us treat IReference<T> more uniformly in Rust as semantically equivalent to Option<T>. The bindings can then be simplified to model IReference<T> properties as Option getters and setters rather than Param<IReference<T>> and Result<IReference<T>> respectively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant