News for hackers. Stuff that matters.
Re:I am disappointed by dynamic typing by goto11 on Tuesday November 29, 2022 @02:38PM (#33792176)
> You pass an int into a method that expects a string, what's the expected behavior?

Probably an exception, depending on the language. E.g. if the method expects the argument to support the method "substring()" it would be expected to throw an exception if the passed object does not have such a method.

If you pass an object which support the expected interface but with a completely different semantics, then you probably get a weird unexpected behavior. But that would also be the case in a statically typed language.

There are no comments on this comment yet.