Confusion with Module Named Units

I just spent way more time than I would like to admit trying to name a module “Units”. It seemed like all methods, properties, and enums could not be found. I got all kinds of weird/cryptic error messages. Eventually in a sample project I found that it was colliding with the “Units” enum from the “Reports” module.

I ended up picking a different name and got it to work but I hope no one else ends up wasting time like I did.

1 Like

Consider all class, method, property, etc, in short: all names used by Xojo itself being reserved words. Re-using them in your own context will produce errors.

Documentation: Units


I didn’t find that when searching in the local reference, only when I went online.

Yeah, the documentation search function poses a unique challenge to those who seek information about all things Xojo.

Well Xojo is not different from other tools where you can’t use many reserved words. I didn’t check, but there should be a section on reserved words.


Did not show up in reserved words when I checked.

Current hel sucks, and it is a shame but also the IDE/compiler. It shuldnt allow you to name something with a “reserved” word or at least give you a propper error when compiling.

Also don’t use control_event for method names, this is undocumented afaik

The warnings/errors were not very helpful either.

1 Like

In case of doubt (something do not went as expected), I add a prefix; like MyUnits or My_Units…

I stopped using non ASCII to name things around 40 years ago (when it as illegal, of course, in file names). But before Xojo, I forget and use non ASCII characters in the Project Path: I stopped after a day of hell…

Of course, youngsters know nothing about those times…

When it didn’t work, I isolated what I was doing in a blank project and found the name conflict fast. Just wish the error messages were a bit more helpful.

1 Like