[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Review Request: KSpread: Distinguish between void parameter and
From:       "Johannes Simon" <johannes.simon () gmail ! com>
Date:       2010-05-17 15:49:04
Message-ID: 20100517154904.28466.5430 () localhost
[Download RAW message or body]



> On 2010-05-17 15:18:43, Thomas Zander wrote:
> > Maybe a silly question, but would it not be easier (and more in like with Qt \
> > APIs) to instead fix isEmpty to return true for an null (and thus empty) Value ?

That is what the previous version of this patch did. The problem with that is that \
(though it's convenient to use isEmpty()) some code does use a switch construct to \
iterate over all possible types of a Value. So having a "case Empty: " line doesn't \
cover null values, though that's wanted most of the time. Ok, that code could be \
changed, but I think it's confusing nonetheless because isEmpty() does return true in \
both cases and that difference between the two ways of checking the type might easily \
be overlooked. Also comparing a null value to Value::empty() using the == operator \
would yield an unexpected result (they're not equal because of the different type).

So this 'null' value is designed to only make a difference if you really care (by \
explicitly checking isNull()).


- Johannes


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/3993/#review5696
-----------------------------------------------------------


On 2010-05-17 08:45:18, Johannes Simon wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/3993/
> -----------------------------------------------------------
> 
> (Updated 2010-05-17 08:45:18)
> 
> 
> Review request for KOffice.
> 
> 
> Summary
> -------
> 
> A patch to distinguish between a void/null parameter ("nothing", as the third \
> argument in IF(true;1;)) and an empty value. 
> The change is designed to be backwards-compatible as it only has an effect on code \
>                 that explicitly checks if the value is the new type 'null'.
> Reason: A null value is also an empty value, but not the other way around.
> 
> This is to counteract the counter-intuitive behaviour of =IF(true;A1;B1) which will \
> evaluate to "0" if B1 is empty. Using this to concatenate strings will result in \
> odd extra characters. 
> Rational behind this: OpenFormula defines IF(true;XZY;) to be "0". That behaviour \
> is retained. If an empty cell is explicitly used, however, the result is empty just \
> like one would expect, which does not contradict with the OpenFormula \
> specification. It's more intuitive and, last but not least, the way OpenOffice \
> handles it.  
> 
> Diffs
> -----
> 
> trunk/koffice/kspread/Formula.cpp 1124538 
> trunk/koffice/kspread/Value.h 1124538 
> trunk/koffice/kspread/Value.cpp 1124538 
> trunk/koffice/kspread/functions/logic.cpp 1124538 
> trunk/koffice/kspread/tests/TestLogicFunctions.cpp 1124538 
> 
> Diff: http://reviewboard.kde.org/r/3993/diff
> 
> 
> Testing
> -------
> 
> No regressions in unit tests. Added new testcase.
> 
> 
> Thanks,
> 
> Johannes
> 
> 

_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic