Content deleted Content added
Adding WikiProject-based categories (using WikiProjects listed on talk page) as parameters to Template:Expert needed, Template:Expert etc, to clear out the unhelpful Category:Articles needing unspecified expert attention. |
|||
(43 intermediate revisions by 36 users not shown) | |||
Line 1:
{{Short description|Programming languages with runtime extensibility}}
{{Multiple issues|
{{disputed|date=March 2012}}
{{confusing|date=October 2009}}
}}
A '''dynamic programming language''' is a type of programming language that allows various operations to be determined and executed at runtime. This is different from the compilation phase. Key decisions about variables, method calls, or data types are made when the program is running, unlike in [[Static program analysis|static languages]], where the structure and types are fixed during compilation. Dynamic languages provide flexibility. This allows developers to write more adaptable and concise code.
For instance, in a dynamic language, a variable can start as an integer. It can later be reassigned to hold a string without explicit type declarations. This feature of dynamic typing enables more fluid and less restrictive coding. Developers can focus on the logic and functionality rather than the constraints of the language.
==Implementation==
Line 16 ⟶ 12:
===Eval===
Some dynamic languages offer an ''[[eval]]'' function. This function takes a string
===Object runtime alteration===
A type or object system can typically be modified during runtime in a dynamic language. This can mean generating new objects from a runtime definition or based on [[mixin]]s of existing types or objects. This can also refer to changing the [[Inheritance (
===Type inference===
As a lot of dynamic languages come with a dynamic type system, runtime inference of types based on values for internal interpretation marks a common task. As value types may change throughout interpretation, it is regularly used upon performing atomic operations.
===Variable memory allocation===
Static programming languages (possibly indirectly) require developers to define the size of utilized memory before compilation (unless working around with pointer logic). Consistent with object runtime alteration, dynamic languages implicitly need to (re-)allocate memory based on program individual operations.
===Reflection===
[[Reflection (computer science)|Reflection]] is common in many dynamic languages, and typically involves [[Introspection (computer science)|analysis]] of the types and metadata of generic or [[Type polymorphism|polymorphic]] data. It can, however, also include full evaluation and modification of a program's code as data, such as the features that Lisp provides in analyzing [[S-
===Macros===
A limited number of dynamic programming languages provide features which combine [[code introspection]] (the ability to examine classes, functions, and keywords to know what they are, what they do and what they know) and eval in a feature called [[Macro (computer science)|macros]]. Most programmers today who are aware of the term ''macro'' have encountered them in [[C (programming language)|C]] or [[C++]], where they are a static feature which is built in a small subset of the language, and are capable only of string substitutions on the text of the program. In dynamic languages, however, they provide access to the inner workings of the compiler, ''and'' full access to the interpreter, virtual machine, or runtime, allowing the definition of language-like constructs which can optimize code or modify the syntax or grammar of the language.
[[Assembly language|Assembly]], [[C (programming language)|C]], [[C++]], early [[Java (programming language)|Java]], and [[Fortran]] do not generally fit into this category.{{clarify|date=September 2016}}
The earliest dynamic programming language is considered to be Lisp (McCarthy, 1965) which continued to influence the design of programming languages to the present day.<ref>{{cite book| last=Harper| first=Robert | title=Practical Foundations for Programming languages | page=195 | year=2016 |publisher=Cambridge University Press| ___location=New York| isbn=9-781107-150300}}</ref>
==Example code==
Line 101 ⟶ 105:
#<PERSON Eva Luator age: 25>
</syntaxhighlight>
let foo = 42; // foo is now a number
foo = "bar"; // foo is now a string
foo = true; // foo is now a boolean
===Assembling of code at runtime based on the class of instances===
Line 163 ⟶ 170:
* [[ActionScript]]
* [[BeanShell]]<ref>[http://static.springsource.org/spring/docs/2.0.x/reference/dynamic-language.html Chapter 24. Dynamic language support]. Static.springsource.org. Retrieved on 2013-07-17.</ref>
* [[C Sharp (programming language)|C#]] (using
* [[Clojure]]
* [[CobolScript]]
Line 172 ⟶ 179:
* [[Elixir (programming language)|Elixir]]
* [[Erlang (programming language)|Erlang]]
* [[Forth (programming language)|
* [[Gambas]]
* [[GDScript]]
* [[Groovy (programming language)|Groovy]]<ref>< {{cite web |url=http://groovy.codehaus.org/ |title=
* [[Java (programming language)|Java (using Reflection)]]
* [[JavaScript]]
Line 182 ⟶ 189:
* [[MATLAB]] / [[GNU Octave|Octave]]
* [[Objective-C]]
* [[Object REXX|ooRexx]]
* [[Perl]]
* [[PHP]]
Line 190 ⟶ 198:
* [[Raku (programming language)|Raku]]
* [[Rebol]]
* [[Ring (programming language)|Ring]]
* [[Ruby (programming language)|Ruby]]
* [[Smalltalk]]
Line 210 ⟶ 219:
==External links==
''(Many use the term "scripting languages".)''
* {{cite journal |last1=Prechelt |first1=Lutz |date=2002-08-18 |df=mdy |title=Are Scripting Languages Any Good? A Validation of Perl, Python, Rexx, and Tcl against C, C++, and Java |
* {{cite web |last1=Bezroukov |first1=Nikolai |year=2013 |url=http://www.softpanorama.org/Articles/a_slightly_skeptical_view_on_scripting_languages.shtml |title=A Slightly Skeptical View on Scripting Languages |edition=2.1 |work=Softpanorama |access-date=2020-07-27}}
* {{cite speech |author-link1=Larry Wall |last1=Wall |first1=Larry |date=2007-12-06 |df=mdy |url=https://www.perl.com/pub/2007/12/06/soto-11.html/ |title=Programming is Hard, Let's Go Scripting... |event=[[Perl#State of the Onion|State of the Onion]] 11 |work=Perl.com |access-date=2020-07-27}}
* {{cite web |last1=Roth |first1=Gregor |date=2007-11-20 |df=mdy |url=https://www.infoworld.com/article/2077792/scripting-on-the-java-platform.html |title=Scripting on the Java platform |work=[[JavaWorld]] |access-date=2020-07-27}}
* {{cite magazine |author-link1=John Ousterhout |last1=Ousterhout |first1=John K. |date=March 1998 |df=mdy |url=http://www.stanfordlibrary.us/~ouster/cgi-bin/papers/scripting.pdf |title=Scripting: Higher-Level Programming for the 21st Century |
* {{cite news |date=2004-07-26 |df=mdy |url=https://www.activestate.com/company/press/press-releases/activestate-announces-focus-dynamic-languages/ |title=ActiveState Announces Focus on Dynamic Languages |publisher=[[ActiveState]] |access-date=2020-07-27}}
** {{cite web |last1=Ascher |first1=David |date=2004-07-27 |df=mdy |url=https://www.activestate.com/Corporate/Publications/ActiveState_Dynamic_Languages.pdf |title=Dynamic Languages — ready for the next challenges, by design |department=Whitepapers |publisher=[[ActiveState]] |archive-url=https://web.archive.org/web/20081118035341/https://www.activestate.com/Corporate/Publications/ActiveState_Dynamic_Languages.pdf |archive-date=2008-11-18}}
** {{cite web |last1=Ascher |first1=David |date=2004-07-27 |df=mdy |url=http://www.activestate.com/company/newsroom/whitepapers_ADL.plex |title=Dynamic Languages — ready for the next challenges, by design |department=Whitepapers |publisher=[[ActiveState]] |archive-url=https://web.archive.org/web/20081208121835/http://www.activestate.com/company/newsroom/whitepapers_ADL.plex |archive-date=2008-12-08}}
{{Types of programming languages}}
{{DEFAULTSORT:Dynamic Programming Language}}
|