Lotus Script, Derived Class: Reference appears before declaration'?

Hi,

I have written a derived class in the same script library like the base class. But I always get the error symbol (red ball with white cross) in the editor combined with the message “Reference appears before declaration:”

But if I save it and compile it with ‘Tools/Recompile All Lotusscript’ I get an “All code successfully compiled” message !?!

As the order of the classes inside a script library is with the DDE no longer in my hands, this does not make any sense to me !? Smells like a kind of bug, right ?!

Any help/hints appreciated.

TIA, Joe

Subject: “Recompile All” is bugged in 8.5.1, along with a bunch of other general LS problems.

Search around here, I’m pretty sure there’s other discussions with this.

Subject: Derived LS classes and DDE

Uh, too bad, have to roll back to the 8.5 Designer.

Cant’t wait until these problems get solved.

Joe

Subject: Well if you click on the first menu item in your library

That line normally has the agent name or script library as the title then you will get a single summary of your complete code. You can then move parts around and with some fiddling (Cut and paste) the error may disappear. It is annoying but no need to revert back (at least in my case). Recompile all did not solve the error for me although it displays no error message.

Subject: Solution/Work-Around

I tackle this problem by cutting the derrived class and then pasting it back. It seems that internally Designer 8.5 keeps all declarations in the order they were added to the script, but shows them in alphabetical order. By cutting, the declaration is removed and when you paste it back (even if you do this in exact same place) it is re-added at the end of the other declarations, so inetrnally now the derived class is after its base class and error disappears. It seems to work for me 100%

Subject: cut & paste trick works perfect!

Thanks for the tip

Subject: Simple hack…

  • Split your classes into separate libraries and “Use BaseClass” in the derived. Coming from Java, I do this intrinsically, and I have never seen the error you describe. Drawback is you can wind up with silly numbers of Script Libraries, but it puts the order back into your hands. You can also wind up with “UseLSX” errors, but those are nearly always resolvable by judicious employment of “Use”.

Hope this helps…