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

Use C#8 nullable reference types #688

Closed
angularsen opened this issue Aug 9, 2019 · 7 comments
Closed

Use C#8 nullable reference types #688

angularsen opened this issue Aug 9, 2019 · 7 comments
Labels
enhancement help wanted pinned Issues that should not be auto-closed due to inactivity.

Comments

@angularsen
Copy link
Owner

C#8 is due in the fall of 2019 and one interesting feature we can take advantage of is nullable reference types, instead of JetBrains' [NotNull] and [CanBeNull] attributes that don't really give much value to the consumers of the library.

With nullable reference types I believe we can communicate to consumers whether a returned object can be null or not. We use struct value types for all quantities today so I'm not sure how much impact it will make, but we are discussing moving to class instead and at that point it will probably give a lot more value.

Anyway, it's a cool new language feature and if anyone wants to do a PR to play with it, this can be a good start. If no one else does, I'll probably take a stab at it sometime.

@ebfortin
Copy link
Contributor

I'm looking at using Nullable Reference Types as well. From what I understand though it's a compiler only thing. It will not validate at runtime. So it's only usable at compile time with static analysis.

@angularsen
Copy link
Owner Author

Yes that's right. It only has an effect at compile time. Also, it is an optional feature that consumers of the nuget will have to enable in their projects to benefit from. Still, the idea of communicating nullability to nuget consumers is pretty great.

@stale
Copy link

stale bot commented Oct 15, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 15, 2019
@stale stale bot closed this as completed Oct 22, 2019
@angularsen angularsen added the pinned Issues that should not be auto-closed due to inactivity. label Oct 25, 2019
@angularsen angularsen reopened this Oct 25, 2019
@stale stale bot removed the wontfix label Oct 25, 2019
@angularsen
Copy link
Owner Author

angularsen commented Oct 25, 2019

Keeping this one up for a bit in case someone wants to pick it up and run with it.

@lipchev
Copy link
Collaborator

lipchev commented Jan 3, 2025

@angularsen Are the jet-brains annotations still used anywhere: I cannot find anything, but I may not be searching right...

@angularsen
Copy link
Owner Author

angularsen commented Jan 3, 2025

If you search for JetBrains.Annotations in the codebase, you should find using statements or similar if we do use it. Either way, we can just remove the nuget and remove any lingering usages. I see no point in keeping it around, since we already enabled nullable analysis a long time ago.

Closing this as fixed.

Update: Seems we already removed Jetbrains nuget in release/v6 branch.

@angularsen
Copy link
Owner Author

angularsen commented Jan 3, 2025

Fixed in #789 and #798

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted pinned Issues that should not be auto-closed due to inactivity.
Projects
None yet
Development

No branches or pull requests

3 participants