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

*Subject*: **[OASIS Issue Tracker] Issue Comment Edited: (OFFICE-2470) 3.2Expression Calculation is a mixure of observations, rules and possiblesuggestions - NEEDS-DISCUSSION**

*From*:**OASIS Issues Tracker <workgroup_mailer@lists.oasis-open.org>***To*: office@lists.oasis-open.org*Date*: Tue, 2 Nov 2010 11:28:15 -0400 (EDT)

[ http://tools.oasis-open.org/issues/browse/OFFICE-2470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=22839#action_22839 ] David Wheeler edited comment on OFFICE-2470 at 11/2/10 11:28 AM: ------------------------------------------------------------------ Revision: {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 of a constant Number (per section 5.3), a constant String (per section 5.4), a Reference (per section 5.8), constant Error (per section 5.12), the value of that type 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. 4. If an expression consists of a named expression, the result of evaluating the named expression is returned. 5. If an expression consists of an Array, QuotedLabel, or AutomaticIntersection, its value is returned per section 5. 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. For display, the Reference is then converted to the referenced value per the rules of section 3.3 (Non-Scalar Evaluation) item 1.2 apply. 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. was (Author: david.wheeler): Revision: {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 of a constant Number (per section 5.3), a constant String (per section 5.4), a Reference (per section 5.8), constant Error (per section 5.12), the value of that type 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. 4. If an expression consists of a named expression, the result of evaluating the named expression is returned. 5. If an expression consists of an Array, QuotedLabel, or AutomaticIntersection, its value is returned per section 5. 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]