Open KGOH opened 4 years ago
Do not check type, but sets of units instead. (i.e. treat as parameters units involved in operation)
Result value should have type of the left operand either more broader type of the right operand if left operand's type can't hold the result value
Example: ^:date{:year 2020, :month 9, :day 9} + ^{:datetime :delta}{:day 1} = ^:date{:year 2020, :month 9, :day 10} But ^:date{:year 2020, :month 9, :day 9} + ^{:datetime :delta}{:day 1, :hour 1} = ^:datetime{:year 2020, :month 9, :day 10, :hour 1} And ^:datetime{:year 2020, :month 9, :day 9} + ^{:date :delta}{:day 1} = ^:datetime{:year 2020, :month 9, :day 10}
There is no guarantee that same units of the different types have the same definition. Should we consider comparsion not only by units but by their sequences too? Should we allow them to be different?
Do not check type, but sets of units instead. (i.e. treat as parameters units involved in operation)
Result value should have type of the left operand either more broader type of the right operand if left operand's type can't hold the result value
Example: ^:date{:year 2020, :month 9, :day 9} + ^{:datetime :delta}{:day 1} = ^:date{:year 2020, :month 9, :day 10} But ^:date{:year 2020, :month 9, :day 9} + ^{:datetime :delta}{:day 1, :hour 1} = ^:datetime{:year 2020, :month 9, :day 10, :hour 1} And ^:datetime{:year 2020, :month 9, :day 9} + ^{:date :delta}{:day 1} = ^:datetime{:year 2020, :month 9, :day 10}