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

Moving code that is not valid in WRC from Common code to NetFramework… #460

Merged
merged 2 commits into from
Jul 3, 2018

Conversation

tmilnthorp
Copy link
Collaborator

More work towards #409. I pulled out all code hidden behind the following preprocessor directive and moved it to the NetFramework code generator.

#if !WINDOWS_UWP

@tmilnthorp tmilnthorp requested a review from angularsen July 2, 2018 18:50
Copy link
Owner

@angularsen angularsen left a comment

Choose a reason for hiding this comment

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

Very nice!

/// <summary>
/// Get nullable $quantityName from nullable $($unit.PluralName).
/// </summary>
public static $($quantityName)? From$($unit.PluralName)($($quantityValueType)? $valueParamName)
Copy link
Owner

Choose a reason for hiding this comment

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

Outside this PR, but in light of binary size issues - nullable From methods add twice the method count for all our 800 units and I'm contemplating removing them from the lib in vNext. Thoughts?

It's only a convenience thing the way I see it, and this pattern is also a kind of weird pattern I've not seen anywhere else in .NET or third party libs. I would instead advocate checking null explicitly or using Option<T> or similar to box null value handling.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Generally I think that the consuming library would store the nullable type.

For example they would have an Acceleration? field. Then they either assign it somewhere, or not. I would generally not expect a null to come into a ?FromXXX() method. Rather the unit would just never be constructed.

I'm all for removing them.

Copy link
Owner

Choose a reason for hiding this comment

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

Cool, added to #180 .

@angularsen angularsen merged commit bb28f94 into angularsen:master Jul 3, 2018
@tmilnthorp tmilnthorp deleted the SplitWRC branch July 6, 2018 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants