Abstract modules - take 'em for a spin!

Richard Carlsson richardc@REDACTED
Wed Nov 10 15:20:08 CET 2004


On Tue, 9 Nov 2004, Corrado Santoro wrote:

> On Tue, 2004-11-09 at 16:36, Richard Carlsson wrote:
> > It has not been announced offically, but abstract (i.e.,
> > parameterized) modules were in fact included in R10.
> > Go ahead and try them out!
> Wow! A feature that someone (like) me expected to appear!
>
> But I think that something is still missing. I only took a brief look
> at the paper, but it seems that inheritance is not yet supported. Do
> you think that it could an interesting feature for Erlang?

Maybe. Inheritance does not really become interesting until you
start to make systematic use of plug-ins, and up until now, the
framework for callback modules has been rather primitive (passing
around plain module names), and not _that_ much used.

It would not be hard to allow some form of 'extends' declaration
in modules, and make the runtime system redirect calls to the parent
module if the called function is not defined in the called module.

If you want to experiment with this, you could easily do it by
changing the default error handler module for a process, from the
normal 'error_handler' to your own module, which would inspect the
'module_info()' of the called module, and redirect the call to the
declared parent, if you had written '-extends(my_parent)'. (This
would have a fairly large overhead, and I don't recommend it for
serious work.)

	/Richard


Richard Carlsson (richardc@REDACTED)   (This space intentionally left blank.)
E-mail: Richard.Carlsson@REDACTED	WWW: http://user.it.uu.se/~richardc/
 "Having users is like optimization: the wise course is to delay it."
   -- Paul Graham



More information about the erlang-questions mailing list