Closed
Description
I just found minor breaking change between v5 and v6 that I don't believe was mentioned anywhere:
/// <summary>Get <see cref="Mass"/> from <see cref="TimeSpan"/> times <see cref="MassFlow"/>.</summary>
public static Mass operator *(TimeSpan time, MassFlow massFlow)
{
return Mass.FromKilograms(massFlow.KilogramsPerSecond * time.TotalSeconds);
}
/// <summary>Get <see cref="Mass"/> from <see cref="MassFlow"/> times <see cref="Duration"/>.</summary>
public static Mass operator *(MassFlow massFlow, Duration duration)
{
return Mass.FromKilograms(massFlow.KilogramsPerSecond * duration.Seconds);
}
The TimeSpan
overload has been removed (relying on the implicit conversion to Duration
), and while we have the inverse overload in Duration
(i.e. *(Duration duration, MassFlow massFlow)
) the following expression is no longer correctly inferred:
var massEvaporated = (weightAssay.Date - currentValue.Date) * evaporationRate; // does not compile
Everything is fine if we inverted the order of operations:
var massEvaporated = evaporationRate * (weightAssay.Date - currentValue.Date); // no problem
I personally don't mind the removal (note that the implicit conversion from TimeSpan
is lossless in my upcoming proposal for v6), but if we wanted - there would be no particular difficulty in having the operation overload added to the MassFlow.extra.cs
.
I assume this affects all multiplications with TimeSpan
(e.g. VolumeFlow
and such)..