Squeak Class Documentation category index | class index  
 
ClassBuilder
  category: Kernel-Classes
  superclass: Object
  subclasses:

Responsible for creating a new class or changing the format of an existing class (from a class definition in a browser or a fileIn). This includes validating the definition, computing the format of instances, creating or modifying the accompanying Metaclass, setting up the class and metaclass objects themselves, registering the class as a global, recompiling methods, modifying affected subclasses, mutating existing instances to the new format, and more.

You typically only need to use or modify this class, or even know how it works, when making fundamental changes to how the Smalltalk system and language works.

instance methods
  class definition
  class:instanceVariableNames:unsafe:
mutate:to:
name:inEnvironment:subclassOf:type:instanceVariableNames:classVariableNames:poolDictionaries:category:
name:inEnvironment:subclassOf:type:instanceVariableNames:classVariableNames:poolDictionaries:category:unsafe:
newSubclassOf:type:instanceVariables:from:unsafe:
recompile:from:to:mutate:
reshapeClass:to:super:
silentlyMoveInstVarNamed:from:to:after:

  class format
  computeFormat:instSize:forSuper:ccIndex:
format:variable:words:pointers:weak:

  initialize
  doneCompiling:
initialize

  private
  fixSuperSendsFrom:
fixSuperSendsTo:
hasPrimitiveChangeClassTo
informUserDuring:
recordClass:replacedBy:
reservedNames
showProgressFor:
tooDangerousClasses
tryPrimitiveChangeClassTo:
update:to:

  public
  class:instanceVariableNames:
moveInstVarNamed:from:to:after:
superclass:subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
superclass:variableByteSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
superclass:variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
superclass:variableWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
superclass:weakSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:

  validation
  validateClass:forMoving:downTo:
validateClass:forMoving:upTo:
validateClassName:
validateClassvars:from:forSuper:
validateInstvars:from:forSuper:
validateSubclassFormat:from:forSuper:extra:
validateSuperclass:forSubclass:

class methods
  accessing
  beSilent:
beSilentDuring:
isSilent

  instance creation
  new

  testing
 

instance methods
  class definition top  
 

class:instanceVariableNames:unsafe:

This is the basic initialization message to change the definition of
an existing Metaclass


 

mutate:to:

Mutate oldClass to newClass.
Convert all instances of oldClass and recursively update
the subclasses.


 

name:inEnvironment:subclassOf:type:instanceVariableNames:classVariableNames:poolDictionaries:category:

Define a new class in the given environment


 

name:inEnvironment:subclassOf:type:instanceVariableNames:classVariableNames:poolDictionaries:category:unsafe:

Define a new class in the given environment.
If unsafe is true do not run any validation checks.
This facility is provided to implement important system changes.


 

newSubclassOf:type:instanceVariables:from:unsafe:

Create a new subclass of the given superclass.
Note: The new class may be meta.


 

recompile:from:to:mutate:

Do the necessary recompilation after changine oldClass to newClass.
If required (e.g., when oldClass ~~ newClass) mutate oldClass to newClass
and all its subclasses. If forceMutation is true force a mutation even
if oldClass and newClass are the same.


 

reshapeClass:to:super:

Reshape the given class to the new super class.
If templateClass is not nil then it defines the shape of the new class


 

silentlyMoveInstVarNamed:from:to:after:

Move the instvar from srcClass to dstClass.
Do not perform any checks.


  class format top  
 

computeFormat:instSize:forSuper:ccIndex:

Compute the new format for making oldClass a subclass of newSuper.
Return the format or nil if there is any problem.


 

format:variable:words:pointers:weak:

Compute the format for the given instance specfication.


  initialize top  
 

doneCompiling:

The receiver has finished modifying the class hierarchy.
Do any necessary cleanup.


 

initialize


  private top  
 

fixSuperSendsFrom:

The oldClass is about to be removed from the environment.
Fix all references to super so that the association is different from
the original ST association.


 

fixSuperSendsTo:

The newClass has been exported into the environment.
Fix all references to super so that the association is
the original ST association.


 

hasPrimitiveChangeClassTo

Return true if #primitiveChangeClassTo is supported


 

informUserDuring:


 

recordClass:replacedBy:

Keep the changes up to date when we're moving instVars around


 

reservedNames

Return a list of names that must not be used for variables


 

showProgressFor:

Announce that we're processing aClass


 

tooDangerousClasses

Return a list of class names which will not be modified in the public interface


 

tryPrimitiveChangeClassTo:


 

update:to:

Convert oldClass and all its instances into newClass. The process is to do a two-way #become of the old vs. new instances, then we map the old instances into a temporary class and then we do a one-way become of the old into the new class. The entire process must be run unpreemptively so that
a) nobody can create any more instances of oldClass
(which may happen in a process switch), and
b) in case we don't #primitiveChangeClassTo: nobody can
hold on to any of the old instances (which would #become
instances of the new class later on).
The return value of this method is the temporary class we used for converting instances so that the senders still have a handle on the 'old' class.


  public top  
 

class:instanceVariableNames:

This is the basic initialization message to change the definition of
an existing Metaclass


 

moveInstVarNamed:from:to:after:

Move the given instVar from srcClass to dstClass


 

superclass:subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:

This is the standard initialization message for creating a new class as a
subclass of an existing class.


 

superclass:variableByteSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:

This is the standard initialization message for creating a new class as a
subclass of an existing class in which the subclass is to
have indexable byte-sized nonpointer variables.


 

superclass:variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:

This is the standard initialization message for creating a new class as a
subclass of an existing class in which the subclass is to
have indexable pointer variables.


 

superclass:variableWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:

This is the standard initialization message for creating a new class as a
subclass of an existing class in which the subclass is to
have indexable word-sized nonpointer variables.


 

superclass:weakSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:

This is the standard initialization message for creating a new class as a
subclass of an existing class (the receiver) in which the subclass is to
have weak indexable pointer variables.


  validation top  
 

validateClass:forMoving:downTo:

Make sure that we don't have any accesses to the instVar left


 

validateClass:forMoving:upTo:

Make sure we don't have this instvar already


 

validateClassName:

Validate the new class name


 

validateClassvars:from:forSuper:

Check if any of the classVars of oldClass conflict with the new superclass


 

validateInstvars:from:forSuper:

Check if any of the instVars of oldClass conflict with the new superclass


 

validateSubclassFormat:from:forSuper:extra:

Validate the # of instVars and the format of the subclasses


 

validateSuperclass:forSubclass:

Check if it is okay to use aSuperClass as the superclass of aClass


class methods
  accessing top  
 

beSilent:

ClassDefiner beSilent: true


 

beSilentDuring:

Temporarily suppress information about what is going on


 

isSilent


  instance creation top  
 

new

Answer a new instance of the receiver (which is a class) with no indexable variables. Fail if the class is indexable.


  testing top