Christophe Cavalaria <[EMAIL PROTECTED]> wrote: > If your programs need that much dynamic_cast to work, then your programs are > bad.
Wrong. Look at the absolute mess that the Visitor design pattern is, and how Robert Martin made it much less horrible by turning it into Dynamic Visitor -- which needs so much dynamic_cast it hurts. In Java, you're dynamic_cast'ing all of the time in a totally obscure way, each time you're pulling stuff out of a containter. SomeSillyType foo = (SomeSillyType) (mycontainer.getsomething()); since the container's method returns Object, the cast is dynamic -- only checked at runtime. C++, and the latest Java, give up OO in favour of another paradigm (generic programming) to deal with this, and if this isn't an admission that their "static" (ha!) typesystem doesn't work with OOP properly, I don't know what would count as one. > Besides, it's easy to do a 'safe' dynamic_cast, just assert that the > pointer you get isn't 0 after the cast. or catch the dynamically generated exception in Java's case, sure. You can "easily" implement what a decent language would have in the first place... except that co-variance and counter-variance continue to dog every effort to make a decent "static OOP typesystem", of course...:-) Alex -- http://mail.python.org/mailman/listinfo/python-list