zoukankan      html  css  js  c++  java
  • Dynamic typing

    A programming language is said to be dynamically typed when the majority of its type checking is performed at run-time as opposed to at compile-time. In dynamic typing values have types, but variables do not; that is, a variable can refer to a value of any type. Dynamically typed languages include APLErlangGroovyJavaScriptLisp,LuaMATLABGNU OctavePerl (for user-defined types, but not built-in types), PHPPick BASICPrologPythonRubySmalltalk and Tcl.

     

    Implementations of dynamically typed languages generally associate run-time objects with "tags" containing their type information. This run-time classification is then used to implement type checks and dispatch overloaded functions, but can also enable pervasive[pəˈveɪsɪv ] uses of dynamic dispatchlate binding and similar idioms[ˈidiəm ] that would be cumbersome[ˈkʌmbəsəm  笨重的] at best in a statically typed language, requiring the use of variant types or similar features.

     

    More broadly, dynamic typing can improve support for dynamic programming language features, such as generating types and functionality based on run-time data. (Nevertheless, dynamically typed languages need not support any or all such features, and some dynamic programming languages are statically typed.) On the other hand, dynamic typing provides fewer a priori guarantees: a dynamically typed language accepts and attempts to execute some programs that would be ruled as invalid by a static type checker, either due to errors in the program or due to static type checking being too conservative[kənˈsɚvətɪv ].

     

    Dynamic typing may result in runtime type errors—that is, at runtime, a value may have an unexpected type, and an operation nonsensical for that type is applied. Such errors may occur long after the place where the programming mistake was made—that is, the place where the wrong type of data passed into a place it should not have. This may make the bug difficult to locate.

     



    签名:删除冗余的代码最开心,找不到删除的代码最痛苦!
  • 相关阅读:
    docker 学习操作记录 4
    docker 学习操作记录 1
    centos 旧版本镜像
    zabbix 搭建 mysql 连接报错
    js判断是否为手机或是pc
    滚动翻页vue
    note
    Vue-cli 鼠标监听事件之滚动条
    adobe Keychain mac
    HTML协义代码
  • 原文地址:https://www.cnblogs.com/season2009/p/2539970.html
Copyright © 2011-2022 走看看