Hi, I would like to announce gst-shape git://github.com/MrGwen/gst-shape.git a refactoring of the class shape, a small example of the power of this new refactoring:
Before: primDump: anObject [ "Private - Basic code to dump anObject on the stream associated with the receiver, without using proxies and the like." <category: 'private'> | class shape | self storeClass: (class := anObject class). self register: anObject. class isVariable ifTrue: [self nextPutLong: anObject basicSize]. 1 to: class instSize do: [:i | self dump: (anObject instVarAt: i)]. class isVariable ifFalse: [^self]. class isPointers ifTrue: [^self store: anObject through: [:obj | self dump: obj]]. shape := class shape. shape == #character ifTrue: [^self store: anObject through: [:char | stream nextPut: char]]. (shape == #byte or: [shape == #int8]) ifTrue: [^self store: anObject through: [:byte | self nextPutByte: byte]]. (shape == #short or: [shape == #ushort]) ifTrue: [^self store: anObject through: [:short | self nextPutShort: short]]. (shape == #int or: [shape == #int]) ifTrue: [^self store: anObject through: [:int | self nextPutLong: int]]. (shape == #int64 or: [shape == #uint64]) ifTrue: [^self store: anObject through: [:int64 | self nextPutInt64: int64]]. shape == #utf32 ifTrue: [^self store: anObject through: [:char | self nextPutLong: char codePoint]]. shape == #float ifTrue: [^self store: anObject through: [:float | self nextPutFloat: float]]. shape == #double ifTrue: [^self store: anObject through: [:double | self nextPutFloat: double]]. self notYetImplemented ] After: ObjectDumper >> primDump: anObject [ "Private - Basic code to dump anObject on the stream associated with the receiver, without using proxies and the like." <category: 'private'> | class | self storeClass: (class := anObject class). self register: anObject. class isVariable ifTrue: [ self nextPutLong: anObject basicSize ]. 1 to: class instSize do: [ :i | self dump: (anObject instVarAt: i) ]. class isVariable ifFalse: [ ^ self ]. ^ class shape dumper: self store: anObject ] The support inside Behavior is not totally finished but it goes on the right direction. Gwen _______________________________________________ help-smalltalk mailing list help-smalltalk@gnu.org http://lists.gnu.org/mailman/listinfo/help-smalltalk