squants icon indicating copy to clipboard operation
squants copied to clipboard

Add Kiloyards and Kilofeet to the Length dimension

Open ALPSMAC opened this issue 7 years ago • 5 comments

First real attempt at a PR here for Squants (or much of anything for that matter). Trying to be helpful, so please be gentle ;-)

See issue #298

Thanks and Kind Regards, Andy

ALPSMAC avatar Feb 15 '18 12:02 ALPSMAC

I'm reluctant to accept this. For every other unit of measure in the library, there's a standard that defines it (well, aside from the bitcoin currency). Kiloyards isn't a standard, though.

I understand that the current library design makes adding custom units more cumbersome than it needs to be.

derekmorr avatar Apr 26 '18 21:04 derekmorr

I guess that is a valid point. Being non-US it's difficult for me to tell if Kiloyards is a thing

cquiroz avatar Apr 26 '18 21:04 cquiroz

@cquiroz for my employer it is a thing, and used more broadly in a nautical context in the U.S., although I think its more a historical norm than a real international standard.

On reflection I believe it would be sufficient to represent it as 1000 yards (for a kiloyard) or 1000 feet (for a kilofoot) and we can probably get by with that.

@derekmorr out of curiosity, what is the preferred way to go about adding additional units to this library without having to change the library itself? I see this and this from the README.md but based on what I could grok from the description I'm not sure that's really what I'm looking for.

P.S. Thank you for Squants - this library has been a lifesaver! I can't begin to quantify the number of bugs this has squashed before they ever had a chance to manifest.

ALPSMAC avatar Apr 27 '18 09:04 ALPSMAC

@ALPSMAC You can create additional units outside of Squants by extending the LengthUnit much as you did in the PR. You don't everything that way (eg, string parsing, DSL support), but you can the unit is useful.

As for this PR, do you have any reference to Kiloyards or Kilofeet?

garyKeorkunian avatar Feb 12 '19 06:02 garyKeorkunian

@ALPSMAC - Outside of the fact that these units may not be "standard enough" for this library, the PR is very well done. Thank you for your contribution.

@derekmorr @cquiroz Any additional thoughts on this?

garyKeorkunian avatar Sep 05 '19 04:09 garyKeorkunian