OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

office message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: [OASIS Issue Tracker] Commented: (OFFICE-2470) 3.2 ExpressionCalculation is a mixure of observations, rules and possible suggestions -NEEDS-DISCUSSION

    [ http://tools.oasis-open.org/issues/browse/OFFICE-2470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=22822#action_22822 ] 

David Wheeler  commented on OFFICE-2470:

The proposal improves some things, but it needs work.  I think we all agree on what it's TRYING to say, it's just really tricky to clearly say it correctly. As written, the first list doesn't note the need to evaluate functions (!).  The first item says that Number/Text/Error get returned, but this is ambigous - it is really about constants (many function evaluations will return Number or Text or Error but these aren't supposed to be covered by that rule).  There are a few minor English issues, too; there's at least one grammar error, and the text in some places should be simpler.  The imbalanced ")"s in the item list aren't right (the ")" is not part of its name).

A bigger problem is that this proposed text does not properly handle references or reference lists.  You don't want to prematurely evaluate "[.A1]" because not every function automatically reaches in to find what cell A1 contains (that's done in the "convert..." stuff).  The expression "[.A1:B3]~[.A1]" returns a reference list and NOT just a subset of it; if that passes outside of OpenFormula, then it'll get handled by section 3.3, but that must not be done prematurely; "=SUM([.A1:B3]~[.A1])" is perfectly valid and would NOT trigger 3.3.  Again, the "convert to..." handle the conversions of References to Number/String/etc.

{ASIDE: Section 3.3 item 1.2 has some syntax errors, where it uses =ABS(A1:C1) instead of =ABS([.A1:.C1]) and so on.}

How about this instead? (I took the proposal and edited it a lot):

Change entire section 3.2 Expression Calculation to:

Expressions in OpenFormula *shall* be evaluated by application of the following rules:

1. If an expression consists entirely of a constant Number, Text, Error, Reference, ReferenceList, or Array, it is returned.
2. If an expression consists of one or more operations, apply the operators in order of precedence and associativity as defined by Table 1 in 5.5 (Operators). Precedence of operators may be altered by the use of "(" (LEFT PARENTHESES, U+0028) and ")" (RIGHT PARENTHESES, U+0029) to group operators.  Evaluate the operator as described below.
3. If an expression consists of a function call, evaluate the function as described below.

Operators and functions in OpenFormula are evaluated according to their definitions by applying the following rules:
1. The values of all argument expressions are computed, that is, formulas are normally "eagerly" evaluated. Exceptions to eager evaluation are noted in the function's specification (e.g., see IF).
2. If an argument expression evaluates to Error, calculation of the operator or function may short-circuit and return the Error if the function does not suppress error propagation as noted in the function's specification.
3. If an operator or function is passed a value of incorrect type, call the appropriate implicit conversion function to convert the value to the correct type. If conversion is not possible, generate an Error.
4. The function or operation is called with its argument expressions' results (per rule 1), and the result of the function or operation is the evaluation of the expression.

Once evaluation has completed:
1. If an expression consists entirely of a Reference, the resolved Reference is returned if the Reference refers a single cell. If the Reference does not refer a single cell, the rules of section 3.3 (Non-Scalar Evaluation) item 1.2 apply.  For display, the Reference is then converted to the referenced value.
2. If an expression consists entirely of an Array, the Array is returned. For the display area the rules of section 3.3 (Non-Scalar Evaluation) item 1.1 apply.

> 3.2 Expression Calculation is a mixure of observations, rules and possible suggestions - NEEDS-DISCUSSION
> ---------------------------------------------------------------------------------------------------------
>                 Key: OFFICE-2470
>                 URL: http://tools.oasis-open.org/issues/browse/OFFICE-2470
>             Project: OASIS Open Document Format for Office Applications (OpenDocument) TC
>          Issue Type: Bug
>          Components: OpenFormula
>    Affects Versions: ODF 1.2 CD 05
>            Reporter: Patrick Durusau
>            Assignee: Eike Rathke
>             Fix For: ODF 1.2 CD 06
> 3.2 Expression Calculation is a mixture of observations, rules and possible suggestions.
> For example, it starts by saying formulas are recalculated from "outside in," only to confess a few paragraphs later that is how it "appears to the end user."
> There is one really glaring hole in my proposal, that also exists in the current language.
> We describe the ordering of operators but as far as I can tell, we don't address the situation where there is a mixture of operators and functions.
> Note that I changed #1 from constant number/string and added error.
> As near as I can determine, the only possible outcomes of any expression are:
> 1) a number
> 2) a string
> 3) an error
> 4) a reference
> So, application of these rules self-terminates when any of those conditions obtain.
> Yes, that removes "constant number," "constant string" but those are defined elsewhere anyway.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://tools.oasis-open.org/issues/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]