You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stumbled on this library recently, for what it offers it’s a great API. I was wondering if you’d looked into the possibility of a full replication of units.net? An example of what might be possible, is cross conversion of units when you multiply and divide, so length.mul(anotherLength) returns an area, that sort of thing.
looking in the original repo, it’s all driven by even more codegen than is used here. I was just wondering if you’d already looked into what that whole task would look like, and if it would even work.
not sure if typescript method overloading would allow this sort of thing, for example.
That full API, where units are tracked for you in a type safe way, would be pretty freakin cool, I think.
thanks!
The text was updated successfully, but these errors were encountered:
I haven't yet thought much about how to design it, need to find some extra time for it :)
However, JavaScript (and TypeScript) is missing important and complex features compared to the strong-typed C#.
For instance, there is no way to overload operations, which forces operations implementation to be something like: unit1.add(unit2) instead of unit1 + unit2 which looks and feels way better, and I guess similar problems may come up in the implementation of other original library features.
Specific to your example with cross conversions, TypeScript does support abstract classes, so it should be possible to implement.
Did you already have some specific design in your mind?
Hey there,
Stumbled on this library recently, for what it offers it’s a great API. I was wondering if you’d looked into the possibility of a full replication of units.net? An example of what might be possible, is cross conversion of units when you multiply and divide, so length.mul(anotherLength) returns an area, that sort of thing.
looking in the original repo, it’s all driven by even more codegen than is used here. I was just wondering if you’d already looked into what that whole task would look like, and if it would even work.
not sure if typescript method overloading would allow this sort of thing, for example.
That full API, where units are tracked for you in a type safe way, would be pretty freakin cool, I think.
thanks!
The text was updated successfully, but these errors were encountered: