On Fri, Jul 10, 2015 at 7:33 AM, Charlie Clark
<
charli...@clark-consulting.eu> wrote:
>>> When editing files, which a lot of users do, you want
>>> consistency.
>>
>> And giving users both does not reduce consistency.
>
> It does, because the cached value is not guaranteed in any way when editing
> files.
The cached value is not guaranteed in any way regardless of whether
you expose the formula in the same pass or not.
> In a read-only (or write-only as xlsxwriter does) world I'd have no trouble
> exposing the cached value, which would always have the same degree of
> reliability - we assume it's good. This is no longer the case when the file
> is editable. It seems to me that this is crux of the matter.
There are disagreements where both parties understand each other and
there is just a difference of opinion. But I haven't gotten the sense
that you understand what I'm saying, so I'm not sure this is one of
those disagreements. Let me try to build an understanding:
You say that you're OK with a read-only package exposing the formula
and cached value in the same pass. Fine. We can agree on that.
I don't agree that we assume it's good. The nature of the file format
is such that there is intrinsically no guarantee that a cached value
matches a formula. You already agreed with me in a previous e-mail
that even a file that is saved by the genuine article Microsoft Excel
can have stale cached values (due to manual calculation mode).
But let's put that aside. When you said "in a read-only world I'd have
no trouble exposing the cached value, which would always have the same
degree of reliability" perhaps the gist was "if it's read-only, we
can't make things worse". That I can agree with. If the cached values
match the formulas, reading them both at the same time doesn't change
that. If the cached values do not match the formulas, well, reading
them both at the same time doesn't change that either. OK.
Now, you say you are even OK with a write-only package exposing both
the formula and the cached value. I have trouble seeing why you would
be OK with this, because if you can write the formula and also write
the cached value, then you can definitely write them such that they do
not match.
So, let me assume you'd like to be as conservative as possible and
retract your endorsement of making both the cached value and the
formula writable properties in a write-only package.
Now, here is my question for you: How does making only one of the
properties writable (as openpyxl does) help you?
Let's say you have just read in a file whose cached values all match
their formulas. And let's say you've chosen for openpyxl to expose the
cached values. Am I correct that openpyxl then lets you write anything
you like in the cached value, but leaves the formula untouched? If so,
then clearly exposing the cached value as a writable property is not
protecting you from inconsistency at all.
Or, let's say you have chosen for openpyxl to expose only the
formulas. So, is it true that openpyxl lets you overwrite an existing
formula with a new one? Now, if the cached value had been consistent
with the original formula, and you've just changed the formula, how
has openpyxl protected you from inconsistency?
If anything, exposing both the formula and the cached value
*increases* the user's ability to keep things consistent, because they
can update the formula, and then in the same pass, update the cached
value to match.
Well, that's quite an onus on the user, to keep both the formula and
the cached value in sync, isn't it? Yes, indeed it is. But that is
fundamental to the nature of the file format. If you want them to be
in sync, either the library should do it for you, or the library
should give you the ability to do it yourself. And currently, openpyxl
does neither. But it DOES let you take a synchronized file and put it
out of sync.
John Y.