[squeak-dev] Re: Undoable environment ?
itsme213
itsme213 at hotmail.com
Wed Apr 30 14:22:00 UTC 2008
"Gary Chambers" <gazzaguru2 at 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
More information about the Squeak-dev
mailing list
|