Scope with Nested Modules?

I am trying to get religious about using namespaces for organization and information hiding… but maybe I am getting over zealous?

This a simplification of my config:

Module1 Private Interface1 ' private to module1 Module2 Public Class1

The way I understand scope, Interface1 should be available for use in any class of module1 or it’s submodule’s classes regardless of teh class’s degree of nesting. By use I mean casting a class instance to interface 1 or assigning that interface to any class in that scope)

So I want Interface1 to be ONLY available to be used in all classes in module1 and all classes in it’s sub modules … but when I try to assign interface1 to Module2.Class1, it is NOT in the list interfaces I am presented, and as far as I can see there is no way to type in a fully qualified name to tell it I want to assign interface1 to class1…

Is this intended or a bug? It certainly has a bearing on how I organize my code!

Thanks

  • Karen

I don’t know but try…

Make Interface1 Public
Now you can add the interface to Class1
Make Interface1 Private again and the code seems to work.

Look at Class1’s interfaces and Module1.Interface1 is red. Doesn’t feel right but compiles.

Same can be done to subclass a private class from a higher module.

[quote=275725:@Will Shank]Look at Class1’s interfaces and Module1.Interface1 is red. Doesn’t feel right but compiles.

[/quote]

Thanks.

Sounds like an IDE bug if it compiles and works (which IMO it logically should)…

I guess I should report it so it can be added to Norm’s todo list.

<https://xojo.com/issue/44352>

What I am seeing is a separate bug related ONLY to interface scope.

I downloaded the example project and it works as expected in 2016R1.1 on OSX 10.9.5 … I DO see interface1 in THE LISTS of interfaces although as reported in the that FB when I try to assign it the method is not created

I am talking about the interface NOT SHOWING UP in the list of interfaces at all.

When the interface is in a higher level of module nesting (as in my example above) than the class then I do not see the interface in the list of interfaces presented at all.

The error i am seeing is that it is not showing all he interfaces that should be in the scope of the class

<https://xojo.com/issue/44513>

Its actually the exact same problem Karen
It doesn’t add them for the exact same reason you dont see it in the list

[quote=275924:@Norman Palardy]Its actually the exact same problem Karen
It doesn’t add them for the exact same reason you dont see it in the list[/quote]

I reported it separately because I saw different behavior. I understand the root cause is interface scope, but I just want to make sure both manifestations of the issue was fixed. The first one only dealt with the methods not being added.

Theoretically it would be possible to fix the bug in the case in the original report without fixing the bug in the case in my report. I just wanted to make sure it was addressed.

  • Karen

Nope
The reason it doesn’t add them is that the scope resolution is messed up
Which is the same issue you reported

Different symptoms - same root cause