Because the thinking of most language designers is too static.
Although such functions are dangerous in the hands of programmers, they are essential tools for library developers. For example, in Java you can create objects without calling the constructor (yes, you can!), But this power is granted only to library developers. However, many features that library developers will kill in Java may not be available. C #, on the other hand, adds all the dynamic functions to each version. I really look forward to all the amazing libraries that can be built using the upcoming DLR (Dynamic Language Execution).
In some dynamic languages, such as Smalltalk (and also as far as I know Perl and Python, but not Ruby), it is quite possible to change the class of the object. In Pharo Smalltalk, you achieve this with
object primitiveChangeClassTo: anotherObject
which changes the object class to anotherObject class. Note that this is not the same as object become: anotherObject , which swaps all the pointers of both objects.
akuhn source share