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

Better shorthand for units #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

adamchalmers
Copy link
Collaborator

@adamchalmers adamchalmers commented Jul 18, 2023

My proposal: these are all valid KCL expressions for the same value.

  • Distance.Meter(1) -- fully spelled out, using normal KCL syntax.
  • 1.Meter -- using "unit suffix" notation, which is syntactical sugar (aka shorthand) for the above
  • 1.m -- very commonly-used units have a second, shorter unit suffix.

Thanks to @lf94 for suggesting this!

@adamchalmers adamchalmers force-pushed the achalmers/unit-aliases branch from 2852c9b to c41bce9 Compare July 18, 2023 18:40
@lf94
Copy link

lf94 commented Jul 18, 2023

Why is the . (period) necessary?

I also believe having too many ways to express the same thing is just confusing.

@alteous
Copy link

alteous commented Jul 19, 2023

@jtran
Copy link

jtran commented Jul 23, 2024

More prior art:

@jtran
Copy link

jtran commented Nov 21, 2024

Not sure where else to put this, but the maintainer of dimensional, the Haskell package, just posted this:

Scientific computing with confidence using typed dimensions

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.

4 participants