Question

Why would a programming language want to use weak typing over strong typing?

Was it helpful?

Solution

At a very basic level, it'll also make it easier for beginners to pick up. (Probably one of PHP's reasons for success, irrespective of whether you appreciate PHP or not.)

That said, the general erosion of sound operational knowledge of memory management, pointers, etc. is a bit of a worrying trend, if only because you can't always stand on the shoulders of giants. (Someone still has to write microcode, high performance device drivers, etc.)

OTHER TIPS

One advantage is supposedly in development time. It allows programmers to spend less time considering and typing out variable types when writing code. Whether or not this offsets the potential increase in mistakes and difficulty understanding the code when you don't know what type a variable is supposed to be, well, that's a question unto itself.

Another reason is that it makes certain kinds of polymorphism easier to deal with. Given a function that takes two arguments and adds them, there's no need to specify them both as int or even as some interface addable. If the + operator can handle the combination of the two args, then it just works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top