[erlang-questions] dialyzer and behaviours

Richard A. O'Keefe ok@REDACTED
Fri Jul 18 02:02:32 CEST 2014


On 17/07/2014, at 5:12 PM, Siraaj Khandkar wrote:
> Richard, what I think Daniil is asking for is only time-depended in a
> language like Erlang.

Indeed.  But C lets you load and unload modules,
Fortran has done that on mainframes since the 60s,
Lisp lets you load new stuff, Python lets you load
new stuff, Smalltalk (even Animorphic Smalltalk)
lets you load and replace stuff, Prolog (even Prologs
with threads and web servers) let you load and replace
stuff, ....

"Languages *like* Erlang" in the relevant sense are
abundant.

It would make sense for Erlang to offer something like
old-fashioned Lisp "block compilation" where a group
of source files are compiled together and loaded together.
That would permit not just things like cross-module
optimisation but cross-module verification.

> In a statically typed language with a module
> system it'd be something like:
> 
>    signature MY_DB =
>        sig
>            val table : unit -> iolist
>        end
> 
>    functor Foo (Db_impl : MY_DB) =
>        struct
>            ...
>        end

The tricky thing here is that ML has been implemented
in two ways:
 ML
> 
> Daniil, is that what you had in mind? Unfortunately this is not possible
> in Erlang, because, as Richard said, calls to module names in Erlang are
> like calls to mutable, global reference cells. The only thing statically
> checkable is that the module name is of type atom(), while the
> implementation of a named module is always swappable at runtime.




More information about the erlang-questions mailing list