nacular / measured Goto Github PK
View Code? Open in Web Editor NEWIntuitive, type-safe units of measure
Home Page: https://nacular.github.io/measured
License: MIT License
Intuitive, type-safe units of measure
Home Page: https://nacular.github.io/measured
License: MIT License
Adding the iOS target should be really easy, why not doing it? In this fork they already did it: https://github.com/ifit/measured/tree/ios-support
If we want to register type adapter for the type how to create it?
Hello,
I have noticed that the equals
function on Measure
class returns true even when the units of two measurements are different.
This is how Swift defines equality in their Measurement too.
However, I have encountered an issue with this implementation using Compose, where my UI is not recomposed when changing units.
I wonder whether it is correct or not to consider the units in the equality function. Was there a particular decision for the current implementation?
If equals
were to include the units in the comparison, we could still use the compareTo
as an alternative for the old behaviour.
To avoid a clash with kotlin Unit
object. In the current form, it will bring a lot of nasty errors.
Enable IR or BOTH mode for JS compillation.
Use compile-time units resolution in order to avoid number boxing.
The basic idea is the following:
Measurement
an interface. And keep the implementation you already have for dynamic units.Measurement
implementation like this:inline class InlineMeasurement(<U: Units>(val value: Double): Measurement<U>
inline fun <reified U:Units> resolveUnits(): Units
and use it to load Units
object when it is needed. The resolver could work in different ways. The simplest way is to load objectInstance
from reflects.Both implementations could be used in different cases: boxing one in cases, when the Units are dynamic, inline when you can infer everything in compile-time.
It is supported in common in 1.3.7x
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.