"Gary Chambers" gazzaguru2@btinternet.com wrote in message
A>>setFoo: aFoo Undoable newOn: [ foo := aFoo ]
Have a look at the Command and CommandHistory clasees. Worked well for our Report Builder...
I am hoping to find a way for Undoable to dynamically extend a few primitives (e.g. assiging to an instVar or indexedVar, probably adding or removing indexedVars, others??).
========== e.g. currently:
Object>> instVarAt: anInteger put: anObject <primitive: 74> ^self basicAt: anInteger - self class instSize put: anObject
========== Dynamically change to:
Object>> instVarAt: anInteger put: anObject self recordIVarChange: anInteger oldVal: self instVarAt: anInteger. self primInstVarAt: anInteger put: anObject
Object>> primInstVarAt: anInteger put: anObject <primitive: 74> ^self basicAt: anInteger - self class instSize put: anObject
=========== Then #recordIVarChange can put undoable/redoable records on the stack.
Does this sound feasible? Scary to dynamically re-define primitive methods, don't know where to start :-(
Sophie