Gw mau tau Static versus dynamic typing dari Basa program. Jelasin dalam bahasa sunda

In static typing all expressions have their types determined prior to the program being run (typically at compile-time).  For example, 1 and (2+2) are integer expressions; they cannot be passed to a function that expects a string, or stored in a variable that is defined to hold dates.

Statically-typed languages can be manifestly typed or type-inferred.  In the first case, the programmer must explicitly write types at certain textual positions (for example, at variable declarations).  In the second case, the compiler infers the types of expressions and declarations based on context.  Most mainstréam statically-typed languages, such as C++ and Java, are manifestly typed.  Complete type inference has traditionally been associated with less mainstréam languages, such as Haskell and ML.  However, many manifestly typed languages support partial type inference; for example, Java and C# both infer types in certain limited cases.

Dynamic typing, also called latent typing, determines the type-safety of operations at runtime; in other words, types are associated with runtime values rather than textual expressions.  As with type-inferred languages, dynamically typed languages do not require the programmer to write explicit type annotations on expressions.  Among other things, this may permit a single variable to refer to values of different types at different points in the program execution.  However, type errors cannot be automatically detected until a piece of code is actually executed, making debugging more difficult. Ruby, Lisp, JavaScript,  and Python are dynamically typed.