I don’t have much experience with statically typed languages (currently learning Scala and loving it!) but one thing I’ve noticed is that they don’t ever seem to have anything like Ruby’s method_missing or ColdFusion’s onMissingMethod. Is there some inherent limitation in statically typed languages that prevent or make this difficult?
I don’t have much experience with statically typed languages (currently learning Scala and loving
Share
Certainly a mechanism for handling them could be added, but it is at odds with what static typing is: Compile-time determination that your program is free of type errors.
Addendum
Scala 2.9 introduced an experimental option enabling this sort of dynamic handling of accesses to types in ways that would otherwise fail static type checking. It was refined and made non-experimental in 2.10, though it is still controlled by a default-disable feature flag. You can read about it in the SIP 17 document. See SIP 18 for an explanation of Scala 2.10’s “modularization” and feature flags.