I’ve got the problem that the IDE doesn’t allow me to add more modules to another module.
It returns that “Module1 contains Module2, but this is not supported.”
It appears randomly after adding or removing methods and I cannot figure out, what I made wrong.
On the screenshot you can see my structure.
You know you can add a folder in the navigation pane and place Modules (and windows, etc.) in them ?
Sure, but what we always do is, we build easy to use namespaces like
via.api.get(param). Folders don’t give us this ability.
It helps to structure your code better. Especially if you have hundreds of functions like we usually have.
Lars, you know I do not understand why you want to do that part !
I do not even know it is possible to ember modules in modules
How many nested modules can you
The idea is to group the modules by kind:
one master module
many Master.Childs // Sorted by affinity with short names
and each Master.Childs holds a bunch of GrandChilds.
But you may already done that.
I totally agree that there are other ways to structure your code.
In fact, nesting modules in one and another is possible and we’ve done this several times in the past.
The thing is, that now this behaviour occurs and I wanted to know why and if some else experience this as well.
USAs east coast will awake soon and so an answer will certainly come too.
Nested modules is a must for Xojo that already misses basic things like local functions and local classes (writing functions inside functions and nesting classes inside other classes).
Q: We have folders, so why this is important?
A: Modules have scopes and folders not. So you can hide large and complex private functionality from the outside world while allowing a parent public module expose the public “interfaces” to the public functionality. It’s a kind of nesting folders but with scope hierarchy.
Its definitely supported. Something else is going on, I just cant tell what.
Nested folders are only supported for text format. See feedback://showreport?report_id=8265 .
I’ve noticed that the pointed clash was in Module.Name, another guy had a problem in code, also broken, due to his “Object.Name” that always worked before. Some Gremlin seems introduced in the naming of things. Here is the Gremlin: https://forum.xojo.com/57207-smtp-secure-socket-r2019-2-1
@Lars Lehmann - Do you happen to have a folder at the same level as the Module with the exact same name?
[quote=465197:@Greg O’Lone]@Lars Lehmann - Do you happen to have a folder at the same level as the Module with the exact same name?
No, I don’t.
What I made is, I completely recreated the module and compiled it after each step. Took me two hours of work, but now I have the module structure I wanted.
It seems that copying methods into nested modules are responsible for this bug.
Make sure everything in API is Protected, not Global. That property should be Protected, IIRC.
Also, when copy/pasting methods in nested modules, sometimes they look Protected, but you need to update their scope anyway.
Yes, this is smthng we noticed already, but our methods are all protected.
Was still broken. As I mentioned, this is something we already knew. And as you can see in Screenshot, all methods are yellow, which means they are protected.
the property in the screenshot was also protected. The color just applies if you change it again (which seems to be a bug as well).
And it still doesn’t work after manually re-setting the property scope? I improperly said earlier that the Copy/Paste bug only effects methods, and was just testing and found that it applies to all. Once I reset scope manually, I was then able to run my test project.
I would verify that. Copy & Paste will often just use whatever the original values are, but it wouldnt surprise me if the Navigator is trying to be smart and only displaying what they should be.
I reported a similar issue a month ago… Dealing with it costed me a lot of time!