[Libreoffice] [REVIEW][3-4] date change regression fdo#44385

Andrew Douglas Pitonyak andrew at pitonyak.org
Fri Jan 20 17:42:54 PST 2012



On 01/20/2012 10:30 AM, Noel Power wrote:
> On 20/01/12 13:40, Andrew Douglas Pitonyak wrote:
>> On 01/20/2012 06:32 AM, Noel Power wrote:
> note there is a mistake in the table below
>>>
>>> [*] table of behaviour in vba, pre the bug being introduced and post 
>>> patch
>>>
>>>                                mso    old behaviour  present
>>>                             --------------------------------
>>> date + num                    Date      Date          Date
>>> date - num                    Date      Double        Date
>>> date * num                    Double    Double        Double
>>> date / num                    Double    Double        Double
>>> date + date                   Date      Double        Double [1]
> should read
> date / num                    Double    Date        Double
>                                        ^^^^
> e.g.
>
>                                mso    old behaviour  present
>                             --------------------------------
> date + num                    Date      Date          Date
> date - num                    Date      Double        Date
> date * num                    Double    Double        Double
> date / num                    Double    Double        Double
> date + date                   Date      Date          Double [1]
> date - date                   Double    Double        Double
> date * date                   Double    Double        Double
>
> in other words other than the date - num example the 'old' the old and 
> new behaviour *should* match
>
>> The only thing with which I disagree is that I would have addition 
>> and subtraction return the same types. So, I would say that if date + 
>> date returns a date (as your chart shows for MSO) then I would have 
>> date - date return a date as well. If not, then I would leave your 
>> original change as is so that they are consistent for addition and 
>> subtraction.
> I would prefer to preserve compatibility ( especially for (+/-) ) as 
> these are afaics the only operators that really make sense. I have a 
> patch to do that that I would like to commit to master
>>
>> What type is "-date"? I see that never returned a date so (date + 
>> (-date)) will return a date. 
> no idea, it shouldn't be any different then it was before though
>
> Noel
>

I believe that you intend to cause the following behavior:

date + num        Date
date - num         Date
date * num         Double
date / num          Double
date + date        Date [2]
date - date         Double [3]
date * date         Double

[2] - I prefer this, but I would not spend much energy advocating it.
[3] - I would have subtraction return the same type as addition. So, if 
"date + date" returns "date", then I would return date for [3]. If you 
have [2] return a double, then have [3] return a double.

My opinion is that you now just pick one and do it. I will call it a 
consensus and back your decision in the unlikely event I am ever called 
upon to do so.



-- 
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info:  http://www.pitonyak.org/oo.php



More information about the LibreOffice mailing list