[FIX] Module and Metaclass
bergel at iam.unibe.ch
Fri Apr 19 08:41:58 UTC 2002
Add metaclass description when storing a module repository
Bergel Alexandre http://www.iam.unibe.ch/~bergel
-------------- next part --------------
'From Squeak3.3alpha of 30 January 2002 [latest update: #4798] on 15 April 2002 at 1:13 pm'!
!Repository commentStamp: '<historical>' prior: 0!
Repositories are used to deal with everything relating to loading and unloading objects and so on, so that Modules only deal with what a module does when it is in the image.
Repository is an abstract filesystem-based repository. It knows how to store, access and manage the files for a module, including what files are needed, the file names to use and so on. However, a ModuleInstaller is used to perform complex load/install etc. operations.
module a Module -- a reference to my module
directory -- a directory object for the disk- or server-based directory where I store my files
moduleState -- indicates the loading state of the module in the image
installRecord -- may hold info from the install of this module, used for uninstall
isStandalone -- flags whether this repository is stored separately or together with is parent
isAbstract -- flags whether this is a repository with no actual module contents
A Module creates its Repository on demand, unless the repository must be preserved to store information that cannot be recomputed. This saves memory but more importantly prevents repositories from getting out of phase from changes elsewhere.
Externally, repositories are structured into a virtual repository tree that mirrors the virtual module hierarchy, so that the directory path of a repository directly corresponds to the module path. It is a 'virtual' tree because the location of a repository is not hard-wired--there could be mirrors, and sub-repositories may be located on different servers if desired.
A module is only stored in a separate (sub)directory from its parent module if its repository is defined as "standalone". Thus a standalone repository stores its module and any submodules whose repositories are non-standalone. This helps to avoid having very many and very small directories and files.
!Repository methodsFor: 'fileIn/Out' stamp: 'AB 4/15/2002 13:08'!
"Write a complete definition of this module, with metainformation and a
| classes value |
classes _ OrderedCollection new.
self module privateDefinedNames
keysDo: [:key |
value _ (self module
ifAbsent: ) value.
ifTrue: [classes add: value]
ifFalse: [(value isKindOf: Module)
ifFalse: [aStream nextChunkPut: 'self '
, (self module variableDefinitionFor: key);
(ChangeSet superclassOrder: classes)
do: [:class | aStream
nextChunkPut: (self module classDefinitionFor: class);
nextChunkPut: (class class definitionST80: true);
toFile: 0! !
More information about the Squeak-dev