What are the benefits (and drawbacks) of a weakly typed language?

后端 未结 7 917
情书的邮戳
情书的邮戳 2020-12-11 00:52

I\'m a big fan of PHP and it\'s obviously a very weakly-typed language. I realize some of the benefits include the general independence of changing variable types on the fly

7条回答
  •  猫巷女王i
    2020-12-11 01:32

    Straight from wikipedia:

    The advantage claimed of weak typing is that it requires less effort on the part of the programmer than strong typing, because the compiler or interpreter implicitly performs certain kinds of conversions. However, one claimed disadvantage is that weakly typed programming systems catch fewer errors at compile time and some of these might still remain after testing has been completed.

    That's about the same thing I would say. However beware of the relative ambiguity of these terms ("strong typing" and "weak typing") since implicit conversions blur the line.

    Source: http://en.wikipedia.org/wiki/Weak_typing

提交回复
热议问题