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

Time with no direct reference to other units #39

Open
dzmitry-lahoda opened this issue Jan 16, 2019 · 2 comments
Open

Time with no direct reference to other units #39

dzmitry-lahoda opened this issue Jan 16, 2019 · 2 comments

Comments

@dzmitry-lahoda
Copy link

I want to copy some Time from https://github.com/GuOrg/Gu.Units/blob/master/Gu.Units/Time.generated.cs . But right now it mixed with all other units. Could generator put time only items into separate cs file? No links to all other not fundamental to time quantities.

@JohanLarsson
Copy link
Member

JohanLarsson commented Jan 16, 2019

Changing the code gen to put operators in separate parts should not be too hard but in practice it will probably be some pain as the code gen is pretty broken as it is now.

The idea in the beginning was to have the generator UI allowing people to create unit systems of their own choice and generate code for it. Last time I tried the UI thing it was not awesome either.

I'm not sure what your use case is but maybe it is easiest to take the current Time.generated.cs and remove all references to undesired types? Should mostly be the operators IIRC.

@dzmitry-lahoda
Copy link
Author

I can take and remove. Same time I can write MyTime. Not sure where balance is.

Same not only for time, but for Unitless


        /// <summary>
        /// Multiplies <paramref name="left"/> with <paramref name="right"/>
        /// </summary>
        /// <param name="left">The left value</param>
        /// <param name="right">The right value</param>
        /// <returns>The <see cref="Angle"/> that is the result from the multiplication.</returns>
        public static Angle operator *(Unitless left, AnglePerUnitless right)
        {
            return Angle.FromRadians(left.scalar * right.radiansPerUnitless);
}

I kind want Unitless, but not angles.

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

No branches or pull requests

2 participants