[erlang-questions] Is Erlang dynamic language?

Richard O'Keefe ok@REDACTED
Tue Nov 30 01:55:07 CET 2010

On 30/11/2010, at 9:41 AM, Andrey Paramonov wrote:

> Greetings.
> Erlang is definitely a dynamically typed language. But is it a dynamic
> language? I see that the term itself is not what all developers agree
> on - there is a whole discussion on Wikipedia about that (http://
> en.wikipedia.org/wiki/Talk:Dynamic_programming_language).

Look at the list of criteria:
Interpreted?  Yes, maybe, no.  The shell interprets, normal loading
  compiles to byte codes, native code is available.
Dynamically typed?  Yes.  But we're seeing increasing use of
  types for documentation and checking.
Check as much as possible at run time?  No.  By that criterion,
  the only dynamic language I have on any machine would be APL (where
  symbols can change syntax between nullary, unary, and binary so
  that you can't in general tell whether F G H means F(G(H)) or
  G(F,H) until a statement is actually executed, and on the next
  execution it might be different).
No need for type annotations?  Yes.
Modifying properties of the language itself at run time?  Yes,
  in principle.  Nothing stops you writing a modified compiler and
  loading it.  (Which is what you would have to do in Smalltalk too.)
Run-time read-only introspection?  Yes.  (Even Java does that.)
Run-time read-write introspection?  In a language with immutable
  data structures, can you tell the difference between a facility
  that isn't there and one that would have nothing to work on?
  Arguably the tracing and profiling tools *are* this sort of thing.
Dynamically linked?  Yes.
New and shiny?  Shiny but not new.

I think it makes more sense to ask whether a language has a particular
feature or allows a particular effect than to ask whether it is a
"dynamic language" as such.
> Many people associate dynamic languages with metaprogramming, runtime
> method injection, AST transformations and the like. As far as I can
> tell, there is no such things in Erlang.

As for AST transformation, what did you think parse transforms were?

There's a difference between a language in which something cannot be
done at all and a language in which something is awkward.  If you
want *simple* metaprogramming, LFE is a front end for Erlang that
provides Lispy syntax, including macro

I'm not perfectly familiar with the term "method injection"; it seems
to be some form of compiling new functions at run time, possibly from
some sort of template.  It's quite straightforward to generate new
modules (as ASTs) at run time, compile them, and load them.  It's not
a thing people seem to do much, possibly because people don't design
code that needs it.

Erlang is dynamic *enough* for its intended uses.

More information about the erlang-questions mailing list