••• Unprocessable paragraph: \start
Home Segments Index Top Previous Next

782: Mainline

\slidefont

Of course, the chunk-file format for VisualWorks differs slightly from that of Smalltalk Express, because it must carry information about categories and protocols.

For example, if you file out the definitions shown in Segment 779, the specification of the Weight class has an extra category: argument, and the specification of each method includes a protocol designation:

••• Unprocessable paragraph: \begincode Magnitude subclass: #Weight instanceVariableNames: 'magnitude ' classVariableNames: ” poolDictionaries: ” category: 'Experiment'! \par C:\Phw\Onto\Smalltalk\onward.tex •••

!Weight methodsFor: 'accessing'!

magnitude ^ magnitude! !

!Weight methodsFor: 'initializing'!

initialize: aNumber magnitude := aNumber! !

!Weight methodsFor: 'displaying'!

printString ^ magnitude printString , 'gm'! !

!Weight methodsFor: 'arithmetic'!

+ aWeight ^ (self magnitude + aWeight magnitude) gm! !

!Weight methodsFor: 'comparing'!

< aWeight ^ (self magnitude < aWeight magnitude)! ! C:\Phw\Onto\Smalltalk\onward.tex •••