Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    jth41
    @jth41
    Could somebody help me with a question about how quanitity types works?
    Oystein Bjorke
    @objorke
    @jth41 Feel free to ask questions here!
    (don't know if I can answer...)
    jth41
    @jth41
    Hey thanks! I
    I saw here: https://github.com/objorke/QuantityTypes#examples that you have some really cool functionality
    where you make a length and time object and when they are divided you get back a Velocity! that is super cool, how do you do that without hardcoding that operator into every type? @objorke
    Oystein Bjorke
    @objorke
    those operators are coded manually!
    and the quantity types are generated by T4 templates
    jth41
    @jth41
    So every new class has to have every operator relationship built onto it?
    for example if I added a new random unit lets say VolumeVelocity (how quickly a volume is filled) I would need to add to Volume and Speed the operators returning that new type?
    Oystein Bjorke
    @objorke
    yes
    jth41
    @jth41
    VolumeVelocity v = new Volume()/ new Time()
    Oystein Bjorke
    @objorke
    I think the custom operators are defined in partial classes to allow the standard operators to be auto-generated.
    is it "volumetric flow rate"? I have tried to use the same names as wikipedia http://en.wikipedia.org/wiki/Volumetric_flow_rate
    jth41
    @jth41
    gotcha, ok thx for your help. I run this project: https://bitbucket.org/Clearspan/unit-class-library/wiki/Home and was looking for a less tedious way to keep that kind of functionality up to date
    That was just an example I tht of off my head but yes thats what I meant
    Oystein Bjorke
    @objorke
    cool, I will have a look at your project
    jth41
    @jth41
    Would love to compare notes on our libraries, if thats ok
    Oystein Bjorke
    @objorke
    no problem! It's interesting to learn if there are better ways to do this!
    I have added a link to your project on the readme page!
    jth41
    @jth41
    Hey thanks!
    You might also be interested in our other library built on top: https://bitbucket.org/Clearspan/geometry-class-library
    I'm now getting self conscious finding broken links in our readme lol. Yours all seem to work!
    Oystein Bjorke
    @objorke
    thanks for testing :-) please post links if you find more libraries like this
    jth41
    @jth41
    Sure thing. Are you doing anything special for equality?
    Oystein Bjorke
    @objorke
    no, in this library the quantities are value types, and it is similar to comparing a double
    jth41
    @jth41
    Gotcha, That is the only reason we didn't go with value types, It was a super tough problem to solve and I'm not super happy with the solution. But in our library the types can be dynamically changed to consider equality differently for each object