Squeak Class Documentation category index | class index  
 
Metaclass
  category: Kernel-Classes
  superclass: ClassDescription
  subclasses:

My instances add instance-specific behavior to various class-describing objects in the system. This typically includes messages for initializing class variables and instance creation messages particular to a class. There is only one instance of a particular Metaclass, namely the class which is being described. A Metaclass shares the class variables of its instance.

[Subtle] In general, the superclass hierarchy for metaclasses parallels that for classes. Thus,
Integer superclass == Number, and
Integer class superclass == Number class.
However there is a singularity at Object. Here the class hierarchy terminates, but the metaclass hierarchy must wrap around to Class, since ALL metaclasses are subclasses of Class. Thus,
Object superclass == nil, and
Object class superclass == Class.

[Subtle detail] A class is know by name to an environment. Typically this is the SystemDictionary named Smalltalk. If we ever make lightweight classes that are not in Smalltalk, they must be in some environment. Specifically, the code that sets 'wasPresent' in name:inEnvironment:subclassOf:instanceVariableNames:variable:words:pointers:classVariableNames:poolDictionaries:category:comment:changed: must continue to work.

instance methods
  accessing
  allInstances
environment
isMeta
isSystemDefined
name
soleInstance
theNonMetaClass

  class hierarchy
  addSubclass:
removeSubclass:
subclasses
subclassesDo:
subclassesDoGently:

  compiling
  acceptsLoggingOfCompilation
possibleVariablesFor:continuedFrom:
scopeHas:ifTrue:
wantsChangeSetLogging
wantsRecompilationProgressReported

  copying
  copy
veryDeepCopyWith:

  enumerating
  allInstancesDo:
allInstancesEverywhereDo:

  fileIn/Out
  definitionST80
definitionST80:
fileOutInitializerOn:
fileOutOn:moveSource:toFile:
fileOutOn:moveSource:toFile:initializing:
nonTrivial
objectForDataStream:
storeDataOn:

  initialize-release
  adoptInstance:from:
instanceVariableNames:

  instance creation
  new

  instance variables
  addInstVarName:
removeInstVarName:

  pool variables
  classPool

  private
  replaceObsoleteInstanceWith:

  testing
  canZapMethodDictionary
isObsolete

class methods
  anti-corruption
  isScarySelector:

  instance creation
 

instance methods
  accessing top  
 

allInstances

Answer a collection of all current instances of the receiver.


 

environment

Return the environment in which the receiver is visible


 

isMeta


 

isSystemDefined

Answer false if I am a UniClass (an instance-specific lightweight class)


 

name

Answer a String that is the name of the receiver, either 'Metaclass' or
the name of the receiver's class followed by ' class'.


 

soleInstance

The receiver has only one instance. Answer it.


 

theNonMetaClass

Sent to a class or metaclass, always return the class


  class hierarchy top  
 

addSubclass:

Do nothing.


 

removeSubclass:

Do nothing.


 

subclasses

Answer the receiver's subclasses.


 

subclassesDo:

Evaluate aBlock for each of the receiver's immediate subclasses.


 

subclassesDoGently:

Evaluate aBlock for each of the receiver's immediate subclasses.


  compiling top  
 

acceptsLoggingOfCompilation

Answer whether the receiver's method submisions and class defintions should be logged to the changes file and to the current change set. The metaclass follows the rule of the class itself. 6/18/96 sw


 

possibleVariablesFor:continuedFrom:


 

scopeHas:ifTrue:

If the argument name is a variable known to the receiver, then evaluate
the second argument, assocBlock.


 

wantsChangeSetLogging

Answer whether code submitted for the receiver should be remembered by the changeSet mechanism.The metaclass follows the rule of the class itself. 7/12/96 sw


 

wantsRecompilationProgressReported

The metaclass follows the rule of the class itself.


  copying top  
 

copy

Make a copy of the receiver without a list of subclasses. Share the
reference to the sole instance.


 

veryDeepCopyWith:

Return self. Must be created, not copied. Do not record me.


  enumerating top  
 

allInstancesDo:

There should be only one


 

allInstancesEverywhereDo:

There should be only one


  fileIn/Out top  
 

definitionST80

Refer to the comment in ClassDescription|definition.


 

definitionST80:

Refer to the comment in ClassDescription|definition.


 

fileOutInitializerOn:


 

fileOutOn:moveSource:toFile:

File a description of the receiver on aFileStream. If the boolean
argument, moveSource, is true, then set the trailing bytes to the position
of aFileStream and to fileIndex in order to indicate where to find the
source code.


 

fileOutOn:moveSource:toFile:initializing:


 

nonTrivial

Answer whether the receiver has any methods or instance variables.


 

objectForDataStream:

I am about to be written on an object file. Write a reference to a class in Smalltalk instead.


 

storeDataOn:

I don't get stored. Use a DiskProxy


  initialize-release top  
 

adoptInstance:from:

Recreate any existing instances of the argument, oldClass, as instances of
the receiver, which is a newly changed class. Permute variables as
necessary.


 

instanceVariableNames:

Declare additional named variables for my instance.


  instance creation top  
 

new

The receiver can only have one instance. Create it or complain that
one already exists.


  instance variables top  
 

addInstVarName:

Add the argument, aString, as one of the receiver's instance variables.


 

removeInstVarName:

Remove the argument, aString, as one of the receiver's instance variables.


  pool variables top  
 

classPool

Answer the dictionary of class variables.


  private top  
 

replaceObsoleteInstanceWith:


  testing top  
 

canZapMethodDictionary

Return true if it is safe to zap the method dictionary on #obsolete


 

isObsolete

Return true if the receiver is obsolete


class methods
  anti-corruption top  
 

isScarySelector:

Return true if newbieSelector is already a part of Metaclass protocol.


  instance creation top