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

.NET Generator/Runtime: primitive types should all be nullables in props object #715

Closed
assyadh opened this issue Aug 16, 2019 · 3 comments
Labels
closed-for-staleness effort/medium Medium work item – a couple days of effort feature-request A feature should be added or improved. language/dotnet Related to .NET bindings (C#, F#, ...) p1

Comments

@assyadh
Copy link
Contributor

assyadh commented Aug 16, 2019

The reasoning is that in the case of primitives, there is no way to tell if a required primitive was actually set by the customer (ex: a required int will default to 0).

If we set it to int? then the customer has to set a value, and we can then check for the absence of null values in the runtime.

@assyadh assyadh added language/dotnet Related to .NET bindings (C#, F#, ...) feature-request A feature should be added or improved. p0 needs-triage This issue or PR still needs to be triaged. labels Aug 16, 2019
@assyadh assyadh added this to the .NET Support milestone Aug 27, 2019
@assyadh assyadh changed the title .NET Generator/Runtime: primitive types should all be nullables .NET Generator/Runtime: primitive types should all be nullables in props object Aug 27, 2019
@assyadh
Copy link
Contributor Author

assyadh commented Sep 12, 2019

This needs more discussion.

If datatype class A implements interface B, and interface B does not have its properties flagged as optional, then we can not mark them as nullable in A, as this would go against interface B contract.

We would have to alter interface B contract to only carry optional properties because it is implemented by datatype class A.

@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Dec 17, 2019
@MrArnoldPalmer MrArnoldPalmer added p1 and removed p0 labels Dec 17, 2019
@MrArnoldPalmer
Copy link
Contributor

This definitely warrants more discussion as well as some experimentation on our part.

For the purpose of my own understanding, let me restate.

When defining an interface/class/whatever in DotNet, and it has a required primitive type property which is not set by the user during construction, the value will default to whatever the types default value is? So we can't actually tell if it was passed by the user, or just defaulted?

Right now it seems that the Node process would fail and throw an error because the required property is missing. Obviously it would be ideal to catch this before that. However, making this change would mean that though we could catch this in the DotNet runtime, it still would not be detectable at compile time.

Does that seem correct to you @assyadh ?

@github-actions
Copy link
Contributor

This issue has not received any attention in 2 years. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Jun 29, 2023
@github-actions github-actions bot closed this as completed Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-for-staleness effort/medium Medium work item – a couple days of effort feature-request A feature should be added or improved. language/dotnet Related to .NET bindings (C#, F#, ...) p1
Projects
None yet
Development

No branches or pull requests

4 participants