eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ClassBuilder':

Home

everywhere
www.exept.de
for:
[back]

Class: ClassBuilder


Inheritance:

   Object
   |
   +--ClassBuilder

Package:
stx:libbasic
Category:
Kernel-Support
Version:
rev: 1.93 date: 2010/04/26 22:03:53
user: cg
file: ClassBuilder.st directory: libbasic
module: stx stc-classLibrary: libbasic

Class protocol:

checks
o  checkForAliasesOf: oldClass with: newClass
oldClass changed its identity (now use newClass).
check if there are any global aliases, which should also be changed

o  differentInstanceVariableOffsetsIn: class1 and: class2
return a set of instance variable names which have different
positions in class1 and class2.
Also, variables which are only present in one class are returned.
This is used to find methods which need recompilation after a
change in the instance variable layout.

recompiling
o  copyInvalidatedMethodsFrom: oldClass for: newClass
copy all methods from oldClass to newClass and change their code
to a trap method reporting an error.
This is done when a class has changed its layout or inheritance,
before recompilation is attempted.
This allows us to keep the source while trapping uncompilable (due to
now undefined instvars) methods. Later compilation of these methods will show
an error on the transcript and lead to the debugger once called.

o  copyInvalidatedMethodsFrom: oldClass for: newClass accessingAny: setOfNames
copy all methods from oldClass to newClass. Those methods accessing
a variable in setOfNames will be copied as invalid method, leading to
a trap when its executed. This is used when a class has changed its
layout for all methods which are affected by the change.

o  copyInvalidatedMethodsFrom: oldClass for: newClass accessingAny: setOfNames orSuper: superBoolean
copy all methods from oldClass to newClass.
Those methods accessing a variable in setOfNames will be copied as invalid method,
leading to a trap when its executed. If superBoolean is true, this is also done
for methods accessing super. This is used when a class has changed its
layout for all methods which are affected by the change.

o  copyMethodsFrom: oldClass for: newClass
copy all methods from oldClass to newClass.
This is used for class-methods when a class has changed, but its metaclass is
unaffected (i.e. classVars/inheritance have not changed) so there is no need
to recompile the class methods.

o  recompileGlobalAccessorsTo: aGlobalKey in: aNamespace except: someClass
when a new class enters a namespace, all accessors to the same-named
class in that namespace must be recompiled

o  recompileMachineCodeMethodsIn: aClass
recompile all machine-code methods in aClass.


Instance protocol:

accessing
o  classClass

o  classClass: aClass

o  metaclass: metaclassOrASubclassOfIt

o  name: newName inEnvironment: aSystemDictionaryOrClass subclassOf: aClass instanceVariableNames: stringOfInstVarNames variable: variableBoolean words: wordsBoolean pointers: pointersBoolean classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryString comment: commentString changed: changedBoolean classInstanceVariableNames: stringOfClassInstVarNamesOrNil

o  oldMetaclass: aMetaclass instanceVariableNames: stringOfInstVarNames

building
o  buildClass
this is the main workhorse for installing new classes - special care
has to be taken, when changing an existing classes definition. In this
case, some or all of the methods and subclasses methods have to be
recompiled.
Also, the old class(es) are still kept (but not accessable as a global),
to allow existing instances some life.
This might change in the future.

o  newSubclassOf: baseClass type: typeOfClass instanceVariables: instanceVariables from: oldClassArg
anonymous classes can be built with this entry

building-helpers
o  changeReferencesFrom: oldClass to: newClass

o  copyClassInstanceVariablesFrom: oldClass to: newClass

o  determineNewName

o  environmentChanged: how with: argument

o  environmentChangedOrganization

o  fixMethodsIn: newClass

o  flagsForVariable: variable pointers: pointers words: words
Allowing non-booleans as variable is a hack for STX / ST80 compatibility:

o  handleEasyNewClass: newClass
instance layout remains the same.
We only have to recompile methods which access changed class variables
and changed pool variables.

o  handleHardNewClass: newClass

o  handleNewlyCreatedClass: newClass
comment notNil ifTrue:[

o  instantiateMetaclass
create the metaclass proper

o  instantiateNewClassFrom: newMetaclass
create the class proper

o  rebuildForChangedInstanceVariables
changing / adding class-inst vars -
this actually creates a new metaclass and class, leaving the original
classes around as obsolete classes. This may also be true for all subclasses,
if class instance variables are added/removed.
Existing instances continue to be defined by their original classes.

Time will show, if this is an acceptable behavior or if we should migrate
instances to become insts. of the new classes.

o  setPackageInNewClass: newClass fromOld: oldClass

o  setupNewClass: newClass fromOld: oldClass

checks
o  checkClassName

o  checkConventionsFor: className subClassOf: aClass instVarNames: instVarNameString classVarNames: classVarNameString
Check for some 'considered bad-style' things, like lower case names.
NOTICE:
I dont like the confirmers below - we need a notifying: argument, to give
the outer codeview a chance to highlight the error.
(but thats how its defined in the book - maybe I will change it anyway).

o  checkForCircularDefinitionFrom: oldClass

o  checkInstvarRedefsWith: stringOfInstVarNames subclassOf: aClass old: oldClass name: newName

o  checkValidPools
check for invalid subclassing of UndefinedObject and SmallInteger

o  checkValidSubclassing
check for invalid subclassing of UndefinedObject and SmallInteger

o  checkValidVarNamesFor: className subClassOf: aClass instVarNames: instVarNameString classVarNames: classVarNameString
Check for some 'considered bad-style' things, like lower case names.
NOTICE:
I dont like the confirmers below - we need a notifying: argument, or a
notifierSignal to give the outer codeview a chance to highlight the error.
(but that's how its defined in the book - maybe I will change it anyway).



ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 08:36:38 GMT