Coder Social home page Coder Social logo

Comments (7)

phlptp avatar phlptp commented on August 28, 2024

I went back and forth on "am" being attometer and arcminute. The astronomy field in this case won out.

as far as the capitalization, some strings only use capital case for units so it needs to support that, and if it fails on the first pass it just lowers the case and tries again. Where the prefix is unambiguous both the lower case and upper case were allowed.

A couple of those I will look at fixing though.
Thanks

from units.

SimonHeybrock avatar SimonHeybrock commented on August 28, 2024

I went back and forth on "am" being attometer and arcminute. The astronomy field in this case won out.

Ahh, the curse of compromises... apparently no software project can escape from that. ;)

From my point view

  • SI is to be preferred, symbol for minute is min.
  • If you indeed add string formatting for attometer as am (to be consistent with, say, fm) you would not be able to round-trip because string("attometer") -> unit -> string("am") -> unit would yield arcmin.

from units.

phlptp avatar phlptp commented on August 28, 2024

What I am playing with a domain mapping, which could be set by default or controlled through the match_flags argument.

This would trigger different string conversions depending on the specific domain and enable standard SI to be the default.

current planned domains include
cooking
astronomy
nuclear
surveying
ucum
strict_si

these are ones where there are some potential unit strings that mean different things in the different domains.

My inclination is default to more relaxed approach so where the capitalization on the prefix is unambiguous it should be allowed but if the strict_si domain is enabled they would not be.

from units.

SimonHeybrock avatar SimonHeybrock commented on August 28, 2024

That sounds like a very promising approach! Is the plan that multiple domains could be enabled at the same time?

from units.

phlptp avatar phlptp commented on August 28, 2024

Still playing with it as to how it would work. Right now I am leaning towards making strict_si a flag that would disable the flexible capitalization rules for prefixes and a few other things. So that would work with all the others without issue.

The other domains would be mutually exclusive so you couldn't use more than one domain. The mechanism I am using does allow a few exceptions to that so a few particular combination might be allowed, still working out the details.

from units.

phlptp avatar phlptp commented on August 28, 2024

@SimonHeybrock #173 tries to address this and add the domain logic.

from units.

SimonHeybrock avatar SimonHeybrock commented on August 28, 2024

This appears to work now as expected. Thanks a lot!

from units.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.