Re: [Pharo-users] Code loading/unloading order
> Le 26 janv. 2017 à 12:25, webwarriora écrit : > > Thanks. > > Reason why I ask is because I ran into some issues with slots that depended > on other classes in the package (when creating slot, like SomeSlot new > valueClass: SomeOtherClass). I had to move slots into separate package to > make it work. probably because dependency computation done by Monticello does not take into account slots. would be a good addition.
Re: [Pharo-users] Code loading/unloading order
Thanks. Reason why I ask is because I ran into some issues with slots that depended on other classes in the package (when creating slot, like SomeSlot new valueClass: SomeOtherClass). I had to move slots into separate package to make it work. Like when you work on your code it's all good, but then you load it in other image - and whoops... something's broken. -- View this message in context: http://forum.world.st/Code-loading-unloading-order-tp4930611p4930944.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Re: [Pharo-users] Code loading/unloading order
Hi, I think it is not documented, and it's usually strange that people write code dependent on this order. However, to anwer your questions, you can look at MCPackageLoader>>#basicLoadDefinitions. More specific below: On Tue, Jan 24, 2017 at 3:07 PM, webwarriorwrote: > It is not documented. > > What happens when I load a package? > Are all classes created first, and then methods are added, or classes are > loaded one-by-one with all their methods? > - new classes added - new (versions of) methods are compiled - old classes and methods removed - retry definitions that were erroneous - install all new methods - notifications - postloads > What about Slots? Are they added to classes after all classes are loaded? No, they are added to the class when it is created > Do > they have their methods by that time? > It depends. If the class was not loaded before, it does not have methods. If the class existed and you're loading a different version, it'll have the old methods. > What is order of loading of classes? Alphabetical, or using some resolution > mechanism, or is it implementation detail? > It looks by looking at the code that they are sorted by dependency between them (for example, superclasses before subclasses). But I did not look much further. > > What happens when I unload the package? Is it inverse of loading so order > is > reversed? > Apparently, (look at MCPackageLoader class>>#unloadPackage:) the order is reversed by dependency (first methods, then subclasses, then superclasses) Guille
[Pharo-users] Code loading/unloading order
It is not documented. What happens when I load a package? Are all classes created first, and then methods are added, or classes are loaded one-by-one with all their methods? What about Slots? Are they added to classes after all classes are loaded? Do they have their methods by that time? What is order of loading of classes? Alphabetical, or using some resolution mechanism, or is it implementation detail? What happens when I unload the package? Is it inverse of loading so order is reversed? -- View this message in context: http://forum.world.st/Code-loading-unloading-order-tp4930611.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.