Apache OpenOffice (AOO) Bugzilla – Full Text Issue Listing |
Summary: | Allow to declare a Constant dependent of a Public Constant declared in another module. | ||||||
---|---|---|---|---|---|---|---|
Product: | Calc | Reporter: | georgewood1155 <georgewood1155> | ||||
Component: | programming | Assignee: | AOO issues mailing list <issues> | ||||
Status: | CONFIRMED --- | QA Contact: | |||||
Severity: | Normal | ||||||
Priority: | P3 | CC: | elish, issues, marcelly.bernard, rainerbielefeld_ooo_qa | ||||
Version: | 3.3.0 or older (OOo) | ||||||
Target Milestone: | --- | ||||||
Hardware: | PC | ||||||
OS: | All | ||||||
Issue Type: | ENHANCEMENT | Latest Confirmation in: | --- | ||||
Developer Difficulty: | --- | ||||||
Attachments: |
|
Description
georgewood1155
2011-05-16 13:01:02 UTC
Your code has nothing to do with constants, and it works. Please rewrite your code, or better create a document with the error and add it as attachment. Created attachment 76527 [details]
calc spreadsheet with macro example of problem with Public Constant
attachment is a spreadsheet with a library named Example that contains two macros using the Public Constant in modules. Compiling the Use_Constant module results in a Basic Syntax Error.
getting rid of value "enhancement" for field "severity". For enhancement the field "issue type" shall be used. BASIC syntax error. Syntax error. AOO410m1(Build:9750) - Rev. 1539999 2013-11-09_04:08:11 - Rev. 1540252 Debian Version has been modified erroneous, so back to most early version If the scripting code contains a syntax error the syntax error message is not an AOO bug ;-) @georgewood1155: thank you for your feedback! Unfortunately you are wrong here, this is the AOO bug tracking system, not a helpdesk. You can get assistance at <http://user.services.openoffice.org/en/forum/> or here:<http://www.openoffice.org/support/> If you want to report bugs please consider hints on <http://www.openoffice.org/qa/issue_handling/basic_rules.html> Please feel free to reopen this Bug if discussion with other users leaded to an assessment that we have an AOO bug with a current AOO Version and a clear and comprehensible description how to reproduce the problem due to above mentioned guidelines. <http://qa.openoffice.org/issue_handling/pre_submission.html>, <http://www.openoffice.org/qa/issue_handling/basic_rules.html> <http://www.openoffice.org/bugs/bug_writing_guidelines.html>, <http://wiki.openoffice.org/wiki/QA/HowToFileIssue> I disagree with the new status. The problem is reproducible. You cannot declare a constant dependent of a Public constant declared in another module. The syntax error clearly shows that OpenOffice Basic does not accept this. Of course you can declare a *variable* and assign to it an expression depending on a Public constant of another module. So either close it as RESOLVED / INVALID, or better reconsider it as Issue Type ENHANCEMENT. Due to skilled examination Comment 6 Probably not Linux related Sorry, I was to quick with my comment! With your better description of this bug I tried a little bit more to understand the behaviour. Now I found the explanation by myself: You can use constants outside a module without any problems but you _must not_ assign a constant from outside the module to a constant! The reason is to prevent such as: [Module1] Const Const1 = Const2 [Module2] Const Const2 = Const1 But it seems that it isn't documented anywhere. Again. I don't know the implementation of the elements of basic code. But with further tests I see that all declarations with potentially not static values will result in a Basic Syntax Error. Try following: ----------- Option Explicit Sub Main Dim VarInt01 As Integer VarInt01 = 23 Const ConstInt01 = 2 * VarInt01 End Sub ----------- So I conclude that a constant from outside of a module is simply read like a variable. With that and the fact that constants are recognized at compile time rather than run time I don't know if there is a chance for a change of this behaviour. A constant should be a safe defined constant, but look at ---[Modul1]--- Option Explicit Sub Main MsgBox c1 End Sub ---[Modul2]--- Option Explicit Public Const c1 = 23 ---[Modul3]--- Option Explicit Public Const c1 = 47 --------------- -> mroe Bugzilla is not a place discussion but I will answer your comment 12. Your example 1 : Basic is right in stating it as a syntax error. Your example 2 is a different bug. If you feel it important, search if the problem is already reported and if not, create a bug report. There are many bug reports or known limitations in OpenOffice Basic and few developers available to improve the compiler. However it is perfectly possible to write useful and elaborated macros in Basic if you are cautious. (In reply to bmarcelly from comment #13) > -> mroe > Bugzilla is not a place discussion but I will answer your comment 12. I only tried to correct my misleading comment and tried to understand *why* the declaration of constant by a constant from outside the module is claimed as syntax error. But maybe there is no logical reason ... Second example I don't saw as a bug. It should only illustrate "A constant should be a safe defined constant" but like the value of c1 with actual implementation it would mainly random if there are constants with the same name in other modules. |