nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.39k stars 1.47k forks source link

Extend Effect System for Unit and Measurement Tracking #3253

Closed sirinath closed 8 years ago

sirinath commented 9 years ago

Languages like F# (https://msdn.microsoft.com/en-us/library/dd233243.aspx?f=255&MSPPError=-2147217396, http://fsharpforfunandprofit.com/posts/units-of-measure/) and Scala through a library (http://www.squants.com/) have units.

Distinct types are useful mainly when you have the ability to carry the dimensions. Some maybe dimensionless which is the current implementation.

This will be more flexible than my previous proposal: https://github.com/nim-lang/Nim/issues/3252. Also it can be used with distinct types.

dom96 commented 9 years ago

Why did you close https://github.com/nim-lang/Nim/issues/3252 and open this one, the issues are equivalent?

sirinath commented 9 years ago

I was linking initially this can be a feature of distinct but on second thoughts it is better as part of effect to track units and measures.

dom96 commented 9 years ago

Next time just edit the issue instead of closing it and creating a new one.

Araq commented 8 years ago

distinct types in combination with converters work just fine for units of measurements.