Make External an entire Module containing classes

I have created a module containing classes and now I’d like to make the entire component external to be shared among different Xojo apps I’m developing. The attached figure shows the module and classes. Yet, I can’t seem to externalize the module, only the classes (highlighted). And if a module has tons of classes, I have to Make External each of them? I’d like to make sure that the entire entity (module, classes, methods, …) is saved in a shared folder somewhere that I can drag and drop into my Xojo project. Any creative ideas?

Thank you.
Ken

Hi Ken - You can’t make a module external if it contains anything (like classes). This is a known and very hard to fix issue. If you want to make your module external, it must have no contents.

Anthony

[quote=99052:@Anthony Dellos]Hi Ken - You can’t make a module external if it contains anything (like classes). This is a known and very hard to fix issue. If you want to make your module external, it must have no contents.
Anthony[/quote]

Does that mean you can’t make a module external if it already contains something, or that you can never have an external module? In other words, can I create an empty module, make it external, and then add things to it?

An external module can only contain methods and properties. You cannot (successfully) add a class to an external module. It will present it as an option, but won’t actually add it to the module.

oh okay. Thanks, Anthony.

And then once you make the module external, you can add classes to it and they automatically become external too? (I hope!)

Thanks, Tim. Do you agree with what Anthony said that you need to make a module external first and then add components?

So, regarding classes… If I had a collection of classes (for example, file I/O classes), is there some way to make them all external as a group or are they all basically treated as independent elements that can be made external?

A module cannot be external and contain classes, regardless of how you approach this.

Ok. Got it.

Here’s a question. If you create a set of classes in a project and then export them to a shared folder somewhere, I assume that if you replace those classes in your project by dragging them in from this shared folder that those classes automatically become local (embedded) in your project. Any linkage to the external class files is broken. Right, Michael?

[quote=99079:@Howard Whitaker]oh okay. Thanks, Anthony.

And then once you make the module external, you can add classes to it and they automatically become external too? (I hope!)[/quote]
No
It won’t work at all to try & “work around” this
It’s just not supported at all

Move your classes to a Folder and make them external, saving them in a corresponding folder on disk. You can Alt-drag the entire folder into another project and import external references to the entire set of classes. It doesn’t allow them to be name-spaced, but that’s the closest you’re gonna get. (Actually, you can name-space them by moving them into a non-external Module. The module can’t be external, but its contents can.)

Thanks everyone!
Ken

Its one of a handful of very problematic things that a bunch of engineers over he years have tried to solve
So far none of us has succeeded

[quote=99104:@Norman Palardy]Its one of a handful of very problematic things that a bunch of engineers over he years have tried to solve
So far none of us has succeeded[/quote]
Isn’t there a plan to require namespacing in the near future? If so, how are we supposed to namespace classes if they can’t be placed in a module?

no plan to require it

we’re planning to make use of it but thats not incumbent on you to do so

you can keep doing what you’re doing

there are some poorly spec’d out ideas about a means to address a bunch of issues like the external module one but they are so far ideas only

Things like these
<https://xojo.com/issue/23455>
<https://xojo.com/issue/23890>
<https://xojo.com/issue/3215> (believe it or not this is related)
<https://xojo.com/issue/3624>
<https://xojo.com/issue/8265>