Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Programming language
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
====Static and dynamic typing==== In [[static typing]], all expressions have their types determined before a program executes, typically at compile-time.<ref name="typing"/> Most widely used, statically typed programming languages require the types of variables to be specified explicitly. In some languages, types are implicit; one form of this is when the compiler can [[type inference|infer]] types based on context. The downside of [[implicit typing]] is the potential for errors to go undetected.{{sfn|Sebesta|2012|p=211}} Complete type inference has traditionally been associated with functional languages such as [[Haskell]] and [[ML (programming language)|ML]].<ref>{{Cite conference |last=Leivant |first=Daniel |date=1983 |title=Polymorphic type inference |conference=ACM SIGACT-SIGPLAN symposium on Principles of programming languages |language=en |location=Austin, Texas |publisher=ACM Press |pages=88β98 |doi=10.1145/567067.567077 |isbn=978-0-89791-090-3|doi-access=free }}</ref> With dynamic typing, the type is not attached to the variable but only the value encoded in it. A single variable can be reused for a value of a different type. Although this provides more flexibility to the programmer, it is at the cost of lower reliability and less ability for the programming language to check for errors.{{sfn|Sebesta|2012|pp=212β213}} Some languages allow variables of a [[union type]] to which any type of value can be assigned, in an exception to their usual static typing rules.{{sfn|Sebesta|2012|pp=284β285}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)