drgm51600 2013-01-30 04:34
浏览 55
已采纳

为什么框架和这样的弃用函数而不仅仅是更新它们?

For example, jQuery's .live() is deprecated and instead we must use .on() and for MySQL, mysql_* will soon be deprecated and move onto something else... more noteably... mysqli.

Why do frameworks and programming languages deprecate old functions instead of just updating them? Sorry if this is in the wrong place. If it is, tell me where I should post.

  • 写回答

7条回答 默认 最新

  • dongshi8425 2013-01-30 04:38
    关注

    When the design of the function has changed, they want to offer a period of time where both old and new functions are offered (a transition time) and then at some future date, the old version is removed. This could not be done if they kept the same name for the new behavior. .live() and .on() take different arguments and work differently. .on() is more powerful and can be made to simulate .live() if desired, but the two are not compatible without changing the calling code.

    Introducing the new feature with a new behavior, also simplifies the documentation process since it's completely clear which behavior is documented (by which name it's writing about).

    And, when old code includes the newest latest version that no longer supports the old way of doing things, it is much clearer why things don't work when .live() is not even present than if it was present, but had the wrong behavior.

    And, old behaviors like .live() are eventually removed from the code because they are a bad way of doing things (that can lead to significant inefficiencies) so jQuery wants everyone to eventually stop using them. Removing it from future versions is a way of forcing it's usage to decline and eventually go away. The transition period gives the developers a significant amount of time to learn about the need to change and to implement/test the change.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(6条)

报告相同问题?

悬赏问题

  • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果