I am a bit confused and I wonder if someone can give me some guidance.
I have a simple app with one window and one module.
The module contains 5 classes; some methods in one class use the other classes within the module.
All classes within the module and all methods/properties within the classes are set to Public scope and none are subclasses.
Xojo complains when compiling that “This type is private, and can only be used within its module.” when I Dim either of just two of the classes within the methods of another. But is happily allowing me to Dim another of the classes just one line above the ‘offending’ code. If I set those two classes to Global scope then compilation error goes away. If I remove the module name from the dimension line then the error goes away.
In the code below ‘Foo’ is my Module name and Rest, Request, Response are classes with Public scope inside the Foo Module, the code snippets are from a method in another class in the Foo Module that also has Public scope and the method itself has Public scope.
Example that has compilation error:
Dim rst as new Foo.Rest // ok Dim req as new Foo.Request // This type is private and can only be used within its module Dim res as new Foo.Response // This type is private and can only be used within its module
Example that compiles (and works) Ok:
Dim rst as new Foo.Rest // ok Dim req as new Request // ok Dim res as new Response // ok
This issue only surfaced when I decided to refactor and put the classes inside a module. Is it a bug or something that I do not understand properly?
Any ideas appreciated…