[erlang-questions] Modules and function "encapsulation"
Mon Sep 6 02:29:12 CEST 2010
The way I have understood it is that it does exactly what you say in
your last paragraph. I don't like it, but I could live with it, though
I probably would not use it. It has the feeling of viewing modules as
OO classes and wishing to provide a way of inheriting them. :-)
On 6 September 2010 00:02, Richard O'Keefe <> wrote:
> On Sep 1, 2010, at 6:33 PM, Ulf Wiger wrote:
>> The EUC talk mentioned, by Richard Carlsson, has been implemented as
>> an experimental feature. http://www.trapexit.org/Extend_Module
>> Note the experimental status. This is not to say it doesn't work -
>> I daresay it does - but that there is no commitment to keep the
>> feature as-is.
> I read the slides, but I'm afraid they are rather vague.
> Is there a more precise specification anywhere?
> At first blush, this does nothing that
> - (1) explicitly importing the base module's exports into
> the extension module, and
> - (2) allowing the extension module to re-export imported
> would not do. The only problem with doing it that way is
> that the Erlang compiler won't LET you:
> % cat -n foo.erl
> 1 -module(foo).
> 2 -import(bar, [ugh/1]).
> 3 -export([ugh/1, zoo/2]).
> 5 zoo(X, Y) -> ugh(X+Y).
> % erlc foo.erl
> ./foo.erl:3: function ugh/1 undefined
> Relaxing this apparently pointless restriction would be a far
> simpler change to the language than adding -extends; it would
> provide a very very simple way for a module to extend MANY
> modules; and it would be much better than -extends because it
> would be EXPLICIT. As it stands, -extends(bar) says
> "I don't know and I don't care what bar exports.
> I trust bar TOTALLY.
> Whatever bar exports, today, tomorrow, or until the Sun
> goes out, I export that too."
> That really does not seem to be in the spirit of Erlang to me.
> So I must have misunderstood the proposal.
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
More information about the erlang-questions