Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic languages Vs Static languages (can this two be together in the same place)

programming languages are grouped it 2 main classes "Dynamic" & "Static". - Is this always the case a programming language is in one of them and not in both, I mean can a language be dynamic and static at the same time ?

like image 585
Ayoub M. Avatar asked Dec 07 '25 10:12

Ayoub M.


2 Answers

The distinction static and dynamic language is quite ambiguous since it can refer to many different (more or less suitable) criteria. I'll try to answer for each case:

Interpretation/Compilation

This doesn't depend on the language itself but just on the implementation used. Therefore languages can be executed through both an interpreter and a compiler. Examples

  • Haskell (GHC / GHCI / Hugs)
  • C++ (G++ / Ch)
  • F#

Some compiled languages also have the possibility to compile their code at runtime (.NET).

Static/Dynamic typing

Static and dynamic typing (duck typing) can be combined in one language. See C#'s dynamic, VB with Option Explicit/Strict off or Boo. Structural typing can be used to formulate strict typing without explicit type hierarchies. Polymorphic base types (System.Object) support some kind of dynamic behaviour as well, though the type is given statically.

Meta constructs (e.g. Reflection, Runtime type generation)

Are available in Java and .NET too.

Functional techniques(eg. Higher-order functions, continuations)

Can be replicated in statically-typed languages as well. See Haskell or Scala.

like image 193
Dario Avatar answered Dec 11 '25 07:12

Dario


C# 4.0 is a statically typed language that supports dynamic resolution as well. The dynamic keyword basically tells the compiler: don't worry about this for now. If it can't resolved the type at runtime an exception is thrown.

like image 42
Brian Rasmussen Avatar answered Dec 11 '25 09:12

Brian Rasmussen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!