|
Dynamic language means (roughly) that you can change the program
instantly (sometimes even when it's still running !).
If you've ever seen a Lisp-programmer working in the Lisp-environment
(called the 'debugger'), then you would have seen that he typed the
function-definition on a command line like this :
(defun square (x) (* x y) )
He can then execute this function on the next command-line like this :
(square 5) ==> error: the symbol Y has no global value
He sees the error, and he can instantly correct it by supplying the correct
definition:
(defun square (x) (* x x)) (square 5) ==> 25
You see ? It looks like just a programming environment (a stupid one in
this example), but it's actually a build-in feature in the language.
This kind of languages are normally impossible to compile (ok, Dylan is
an expection) because the interpreter can't known anything about the
objects/symbols that the programmer uses. If he finds the 'square'
symbol somewhere inside the definition of a function, then he can't
compile the code to a function-call. He has to wait until the function is
executed : each call can have a different meaning for 'square' (a function,
a list, a keyword, a variable, ...)
The programmer can interactively define, debug, trace and execute the
entire code. You can for example define the 'main-function' without
specifying the definitions of the lower-level functions.
Try that in C or C++ !
|