Why does Dynamic Typing really matter?!?
noway at sorry.com
Fri Feb 7 01:24:02 CET 2003
"David Eppstein" <eppstein at ics.uci.edu> ha scritto nel messaggio
news:eppstein-7A1A00.07531006022003 at news.service.uci.edu...
> In article <623cd325.0302060257.1542e098 at posting.google.com>,
> chastel_pelerin at hotmail.com (Jason Smith) wrote:
> > But what I want need is an solution to a problem that would not be
> > possible to replicate in a statically typed language...
> Take a look at OS X's Cocoa undo manager.
> 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.
This can be done in any statically-typed language in which functions are
first-class objects. This is not the case of C++ for instance, but it can be
faked quite easily with functors (boost::function). Once I have functors
(first-class object functions), I can implement the above very easily.
Actually, I've already done it some years ago.
I think there are much more important benefits with dynamic typing.
More information about the Python-list