nholthaus / units

a compile-time, header-only, dimensional analysis and unit conversion library built on c++14 with no dependencies.
http://nholthaus.github.io/units/
MIT License
952 stars 135 forks source link

Could units support 'metre' as well as 'meter'? #137

Open pattop opened 6 years ago

pattop commented 6 years ago

According to Wikipedia all English speaking countries apart from the United States and the Philippines use the spelling metre.

Personally it is very jarring for me to use the library with the wrong (for my brain) spelling.

Morwenn commented 6 years ago

In my experience, most variables and function names in programming use US English: I've often seen color classes and variables names but hardly ever colour. Even the C++ standard itself uses US English (same example; the 2D Graphics proposal spelled "colour" as "color").

pattop commented 6 years ago

In my experience most engineering/scientific papers & text books prefer the spelling metre because that is the spelling used in ISO 80000-1:

In this International Standard and in the SI, there are seven base quantities and seven base units. The base quantities are length, mass, time, electric current, thermodynamic temperature, amount of substance, and luminous intensity. The corresponding base units are the metre, kilogram, second, ampere, kelvin, mole, and candela, respectively.

However, I wasn't arguing for one or the other. I was asking if units could support both.

Morwenn commented 6 years ago

Citing ISO, fair enough :p

pattop commented 6 years ago

:)

nholthaus commented 6 years ago

@pattop it can. I have aliases for other units where they are common. I'm American so I definitely won't be convinced to use only ISO/British spellings (just saying for the record, I know that's not where you were going with your issue). That being said, any of my contributors could tell you I can't spell anyway in any of the above systems.

pattop commented 6 years ago

OK great. I'm happy to have a go at a patch if you point me roughly in the right direction.

JohelEGP commented 6 years ago

https://github.com/nholthaus/units/blob/40e425ff25fe7739d167d9958ce84d5522510b7d/include/units.h#L3114 It's just a copy&paste of that line with the new spelling. Actually, that shouldn't work because you'd try to redefine m.

nholthaus commented 6 years ago

yeah I'm just going to add this as an alias of meter_t, not as a whole new unit.

nholthaus commented 6 years ago

in the latest v3.x

stellarpower commented 2 years ago

I got caught out with this, compiler error that metre_t isn't found. I may have to import things like "color", but I religiously stick to proper spelling and camelCase in my own code XD. Helps in case I have to model a meter that's read in metres.