|
|
Class: Metaclass
Object
|
+--Behavior
|
+--ClassDescription
|
+--Metaclass
|
+--AutoloadMetaclass
|
+--JavaScriptMetaclass
|
+--PrivateMetaclass
|
+--SmalltalkShareClient::RemoteMetaclass
- Package:
- stx:libbasic
- Category:
- Kernel-Classes
- Version:
- rev:
1.208
date: 2010/04/03 10:46:40
- user: cg
- file: Metaclass.st directory: libbasic
- module: stx stc-classLibrary: libbasic
- Author:
- Claus Gittinger
every classes class is a subclass of Metaclass.
(i.e. every class is the sole instance of its Metaclass)
Metaclass provides support for creating new (sub)classes and/or
changing the definition of an already existing class.
Behavior
ClassDescription
Class
Signal constants
-
confirmationQuerySignal
-
return the query signal which is raised to ask if user
confirmation dialogs should be opened.
If unhandled, they are.
class initialization
-
initialize
-
creating metaclasses
-
new
-
creating a new metaclass - have to set the new classes
flags correctly to have it behave like a metaclass ...
Not for normal applications - creating new metaclasses is a very
tricky thing; should be left to the gurus ;-)
queries
-
asPrivate
-
-
isBuiltInClass
-
return true if this class is known by the run-time-system.
Here, true is returned for myself, false for subclasses.
Compatibility-ST80
-
comment: aString
-
ignored - sometimes found in ST-80 fileOut files.
Comments are supposed to be defined via class messages.
-
sourceCodeTemplate
-
ST80 compatibility - return a definition message for myself.
Same as #definition
autoload check
-
isLoaded
-
return true, if the class has been loaded;
redefined in Autoload; see comment there
class instance variables
-
instanceVariableNames: aString
-
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.
compiler interface
-
browserClass
-
return the browser to use for this class -
this can be redefined in special classes, to get different browsers
-
compilerClass
-
return the compiler to use for this class -
this can be redefined in special classes, to compile classes with
Lisp, Prolog, ASN1, Basic :-) or whatever syntax.
-
evaluatorClass
-
return the compiler to use for expression evaluation for this class -
this can be redefined in special classes, to evaluate expressions with
Lisp, Prolog, ASN1, Basic :-) or whatever syntax.
-
formatterClass
-
return the parser to use for formatting (prettyPrinting) this class -
this can be redefined in special classes, to format classes with
Lisp, Prolog, ASN1, Basic :-) or whatever syntax.
-
parserClass
-
return the parser to use for parsing this class -
this can be redefined in special classes, to parse classes with
Lisp, Prolog, ASN1, Basic :-) or whatever syntax.
-
programmingLanguage
-
return the programming language in which this class is written
-
realSubclassDefinerClass
-
-
subclassDefinerClass
-
Answer an evaluator class appropriate for evaluating definitions of new
subclasses of this class.
-
syntaxHighlighterClass
-
return the class to use for syntaxHighlighting (prettyPrinting) this class -
this can be redefined in special classes, to highlight classes with
Lisp, Prolog, ASN1, Basic :-) or whatever syntax.
copying
-
postCopy
-
redefined - a copy may have a new instance
creating classes
-
name: newName inEnvironment: aNameSpaceOrOwningClass subclassOf: aClass instanceVariableNames: stringOfInstVarNames variable: variableBoolean words: wordsBoolean pointers: pointersBoolean classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryString comment: commentString changed: changed
-
-
name: newName inEnvironment: aNameSpaceOrOwningClass subclassOf: aClass instanceVariableNames: stringOfInstVarNames variable: variableBoolean words: wordsBoolean pointers: pointersBoolean classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryString comment: commentString changed: changed classInstanceVariableNames: stringOfClassInstVarNamesOrNil
-
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.
-
new
-
create & return a new metaclass (a classes class).
Since metaclasses only have one instance (the class),
complain if there is already one.
You get a new class by sending #new to the returned metaclass
(confusing - isn't it ?)
-
newClassBuilder
-
enumerating
-
instAndClassSelectorsAndMethodsDo: aTwoArgBlock
-
-
subclassesDo: aBlock
-
evaluate the argument, aBlock for all immediate subclasses.
This will only enumerate globally known classes - for anonymous
behaviors, you have to walk over all instances of Behavior.
fileOut
-
basicFileOutDefinitionOf: aClass on: aStream withNameSpace: forceNameSpace withPackage: showPackage
-
append an expression on aStream, which defines myself.
-
basicFileOutDefinitionOf: aClass on: aStream withNameSpace: forceNameSpace withPackage: showPackage syntaxHilighting: syntaxHilighting
-
append an expression on aStream, which defines myself.
-
fileOutClassInstVarDefinitionOn: aStream withNameSpace: withNameSpace
-
append an expression to define my classInstanceVariables on aStream
-
fileOutDefinitionOn: aStream
-
-
fileOutOn: outStreamArg withTimeStamp: stampIt withInitialize: initIt withDefinition: withDefinition methodFilter: methodFilter encoder: encoderOrNil
-
file out my definition and all methods onto aStream.
If stampIt is true, a timeStamp comment is prepended.
If initIt is true, and the class implements a class-initialize method,
append a corresponding doIt expression for initialization.
The order by which the fileOut is done is used to put the version string at the end.
Thus, if the version string is expanded (by CVS), the characterPositions of methods should not move
method templates
-
versionMethodTemplateForSourceCodeManager: aSourceCodeManager
-
misc ui support
-
iconInBrowserSymbol
-
can be redefined for a private icon in the browser.
The returned symbol must be a selector of the ToolbarIconLibrary.
private
-
setSoleInstance: aClass
-
queries
-
category
-
return my category
-
comment
-
return my comment
-
getPackage
-
return my package-id
-
hasExtensions
-
return true if I have extensions
-
hasExtensionsFrom: aPackageID
-
return true if I have extensions from a package
-
isBuiltInClass
-
return true if this class is known by the run-time-system.
Here, true is returned for myself, false for subclasses.
-
isMeta
-
return true, if the receiver is some kind of metaclass;
true is returned here. Redefines isMeta in Object
-
name
-
return my name - that is the name of my sole class, with ' class'
appended.
-
nameSpace
-
return the nameSpace I am contained in.
Due to the implementation of nameSpaces (as classVariables),
a class can only be contained in one nameSpace (which is the desired)
-
owningClass
-
return nil here - regular metaclasses are never private
-
package
-
return my package-id
-
soleInstance
-
return my sole class.
-
subclasses
-
ask my non-meta for subclasses
-
theMetaclass
-
return the metaClass of the class-meta pair.
Here, return myself, because I am the metaclass.
Also implemented in my class, which also returns me.
-
theNonMetaclass
-
return the nonMetaClass of the class-meta pair.
Here, return my class object, because I am the metaclass.
Also implemented in my class, which returns itself.
-
topOwningClass
-
return nil here - regular metaclasses are never private
source management
-
binaryRevision
-
-
sourceFileSuffix
-
-
sourceStream
-
return the classes source stream
-
sourceStreamFor: sourceFileName
-
return the sourceStream for a sourceFileName
|