Why does Dynamic Typing really matter?!?
eppstein at ics.uci.edu
Thu Feb 6 18:26:39 CET 2003
On 2/6/03 11:11 AM -0600 Mark McEahern <marklists at mceahern.com> wrote:
>> Basically, every time you run a function that you want to be undoable,
>> you call the undo manager with the function that would be used to undo
>> it. The undo manager remembers these calls and performs them later when
>> undos are requested. It does redos by similarly remembering the calls
>> that would be used to undo what happened while it was doing an undo.
>> In practice this leads to very concise and straightforward looking code
>> that handles infinite levels of undo.
> Fascinating. IIRC, Undo is covered as an example in the GoF Patterns
> book. I wonder, though, would Undo be handled even more simply as an
> Aspect? That is, rather than having to stuff some special incantation
> into the innards of every function that you want to undo-enable, an
> Aspect Oriented Programming approach would involve specifying the
> candidates for undo (I think this is what join points are all about?) and
> then the special undo magic would Just Happen (tm)?
>From my limited understanding of AoP (we have a true expert here, Crista
Lopes, maybe I should ask her) it doesn't save you from the necessity of
writing actual code. You would still need to write the magic incantations,
but you could keep them in a separate aspect and not have to look at them
unless you wanted to think about undoing. Which could be good, if it
helped keep your view of the code simple, or bad, if it led you to forget
to keep the undo aspect synchronized with the rest of your code.
David Eppstein UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/
More information about the Python-list