Which is a better fit for C++: “static typing” or “dynamic typing”?
If you want to use C++ most effectively, use it as a statically typed language. C++ is flexible enough that you can (via ptr casts, unions, and #defines) make it “look” like Smalltalk. But don’t. Which reminds me: try to avoid #define. There are places where ptr casts and unions are necessary and even wholesome, but they should be used carefully and sparingly. A ptr cast tells the compiler to believe you. An incorrect ptr cast might corrupt your heap, scribble into memory owned by other objects, call nonexistent ethods, and cause general failures. It’s not a pretty sight. If you avoid these and related constructs, you can make your C++ code both safer and faster, since anything that can be checked at compile time is something that doesn’t have to be done at run-time. Even if you’re in love with dynamic typing, please avoid it in C++, or else please consider using another language that better supports your desire to defer typing decisions to run-time. C++ performs 100% of its type check