Module properties acting differently in Xojo-2013-Release-2

I have a class mySpecialDictionary with super Dictionary that extends Dictionary to handle objects.
I have a module with property myDictionary As mySpecialDictionary to make this class available to my app.

According to documentation myDictionary should not have to be instantiated with “New” like:
myDictionary = New mySpecialDictionary

It was indeed the case before I upgraded to release 2 that this was working correctly. I upgraded and now I’m suddenly having to instantiate myDictionary when the App opens.

Is anyone else seeing this?

I’ve always had to instantiate Dictionaries using the New keyword, even if the Dictionary is a property of a module. I don’t see how the object could otherwise be instantiated.

Well, interestingly enough I opened Xojo 2013 Release 1 and ran the app to test this… worked fine, didn’t have to do “myDictionary = New mySpecialDictionary”. I then re-opened Xojo 2013 Release 2… and it’s working again.

It appears to be the case you can create a module property like this and it automatically instantiates it for you. The reason I tried it was because of section 8.6 “Modules” in Introduction to Programming with Xojo:

Global variables are commonly stored in Modules. It can be tempting to think of a Module as similar to a class, but there are some important differences. While a Module can contain properties, methods, and functions just like a class can, a Module never needs to be instantiated with the New operator. In other words, a Module always exists in your application.

This doesn’t actually explain what is going on. It just says it magically happens. But it looks like it’s creating an instance of what we’re declaring in the module. So, it’s not really a class… it’s an automatically instantiated class… maybe… and the IDE won’t let you instantiate it so don’t try… maybe… I’ll have to try that next and see what happens…

Do you happen to know of any more advanced documentation on Xojo? Magical mystery stuff like this just kills me.

[quote=20790:@Patrick Langford]I have a class mySpecialDictionary with super Dictionary that extends Dictionary to handle objects.
I have a module with property myDictionary As mySpecialDictionary to make this class available to my app.

According to documentation myDictionary should not have to be instantiated with “New” like:
myDictionary = New mySpecialDictionary

It was indeed the case before I upgraded to release 2 that this was working correctly. I upgraded and now I’m suddenly having to instantiate myDictionary when the App opens.

Is anyone else seeing this?[/quote]

If it ever worked without having to say “new” then that was a bug

Ah, I need to apologize to both of you. A Dictionary does indeed need to be instantiated with New. I wasn’t being careful enough in my testing and it wasn’t working the way I thought. Sorry for all the drama.

[quote=20808:@Patrick Langford]
Global variables are commonly stored in Modules. It can be tempting to think of a Module as similar to a class, but there are some important differences. While a Module can contain properties, methods, and functions just like a class can, a Module never needs to be instantiated with the New operator. In other words, a Module always exists in your application.[/quote]

The documentation here is referring to the Module itself - the docs are saying that the Module doesn’t have to be instantiated with New. Properties which are objects still have to be, even if they’re inside Modules.

Thanks Gavin. That makes sense.