From koffice-devel Mon May 20 10:31:46 2002 From: Ariya Hidayat Date: Mon, 20 May 2002 10:31:46 +0000 To: koffice-devel Subject: Re: KSpread formulas X-MARC-Message: https://marc.info/?l=koffice-devel&m=102189096926570 > KoScript is a programming language, therefore it interprets '&' as bitwise AND > operation. It would be possible to make it concattenate strings when it gets > String types passed. The question is whether this confuses the users... e.g. > 1 & 3 results in 3, > Hello & World gets HelloWorld Which is exactly why I propose to strip more parts of KoScript. Evaluating expression in spreadsheet app like KSpread should be not as complex as executing script commands. Things like "1 & 3" won't likely appear in KSpread expression anyway. And making KoScript somehow understand the so-called Shared Formula in Excel would be another The Right Thing. If nobody against that, furthermore I'd like to propose the following points. I have digged through Gnumeric source code and realized that there are couple of good things we can adopt. (1) making a cell value stored in KSpreadValue class. KSpreadCell is quite a mess with value handling and so on. and we don't need integer, all number are just numbers (should be double), including date/time. this value can holds error from evaluating the expression, incl. error code and optionally message. when we move to rich-text (KoTextParag), it should be easy to extend this class. (2) define 'format', i.e how the cell value should be displayed, e.g precision, currency, and so on. should be put in class KSpreadFormat. and this is likely to be shared among. cells will "apply" a prefined/custom format. improving cell formatting with Excel would be possible. OTOH it also reduces KSpreadCell again. (3) define 'layout', which somehow already there (KSpreadLayout). layout defines apperance of the cell, e.g border, color, font, etc. think of value vs format+layout like document vs view. (4) if we have (2) and (3), it should be difficult to have 'style'. (5) define 'expression' (class KSpreadExpression) will be used to parse and evaluate formula/expression. again, it can be shared among cells for good (copy formula from one cell to another(s) and you only have one instance of KSpreadExpression). for starting, KSpreadExpression might be simply a wrapper/adapter for KSInterpreter. when we move on, it might be interesting to parse expression once and stored in Polish notation (ala Lotus 1-2-3), then with a simple stack-machine, executing expression should be faster. add GNU MP library and KSpread becomes the most precise spreadsheet ever :-) its lexical analyzer is also useful to create color-syntax-highlighted formula editor. Ideas ? Comments ? Flames ? Regards, Ariya _______________________________________________ koffice-devel mailing list koffice-devel@mail.kde.org http://mail.kde.org/mailman/listinfo/koffice-devel