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

Add clause to documentation clarifying the semantics of null values #33

Merged
merged 1 commit into from
Oct 5, 2019

Conversation

Osspial
Copy link
Contributor

@Osspial Osspial commented Oct 5, 2019

Addresses #14 (comment)

Copy link
Contributor

@Lokathor Lokathor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved,

but with the reservation that we should still at some point make the breaking change to use Option<NonNull<c_void>> for fields that are more clearly optional than others. And the method overall should potentially also be changed to be Result<RawWindowHandle, Self::Error>. We should be encoding more of this into the type system whenever we can, even though that's a code break.

@Osspial Osspial merged commit 7ac663c into rust-windowing:master Oct 5, 2019
@Lokathor
Copy link
Contributor

Lokathor commented Oct 5, 2019

@bvssvni Hello! I'm pinging you about this docs update as the rep for GLFW, but feel free to send whoever else would be better suited as a contact point. Ossipal is reprisenting winit interests and I'm speaking for how SDL2 works.

Hopefully this makes your GLFW job easier/clearer!

@bvssvni
Copy link

bvssvni commented Oct 8, 2019

@Lokathor I have not followed this discussion, can you fill me in?

@Lokathor
Copy link
Contributor

Lokathor commented Oct 8, 2019

Essentially, we're confirming that if the backend cannot provide a reasonable value it should return a null pointer or 0 (depending on type) instead of a panic. Then any lib that uses this output is implicitly authorized to try and ask the OS for more info if that happens.

Basically, for GLFW, if there's any case that's expensive or impossible to handle, just throw down a null and the consumer can try on their end if it's absolutely necessary.

For example, SDL2 doesn't give an NSView on Mac, so my wrapper lib just gives the NSWindow and a lib calling for the raw window handle can use that to look up the view themselves if it's really necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants