[erlang-questions] State of -extends(Module)?

56 views
Skip to first unread message

Magnus Müller

unread,
Oct 29, 2012, 6:36:25 AM10/29/12
to erlang-q...@erlang.org
In the never-ending quest of searching help to program as little as
possible, I found Erlang's -extends(Module) directive. There is little
documentation on it, which makes me believe that it is either
an unwanted or not well-supported feature of the language. Is this
correct? Would you recommend keeping away from it?


Magnus

P.s. Google didn't give me a lot of results when searching for this
except older blog entries (3-4 years old) and a paper from 2007. I
didn't find a discussion of its state.

Loïc Hoguin

unread,
Oct 29, 2012, 6:46:32 AM10/29/12
to Magnus Müller, erlang-q...@erlang.org
On 10/29/2012 11:36 AM, Magnus Müller wrote:
> In the never-ending quest of searching help to program as little as
> possible, I found Erlang's -extends(Module) directive. There is little
> documentation on it, which makes me believe that it is either
> an unwanted or not well-supported feature of the language. Is this
> correct? Would you recommend keeping away from it?

As a general rule, keep away from anything undocumented. They are either
internal code (that may change at any time) or experimental features
(that may be removed at any time).

I do not think it is used anywhere in OTP. I am not sure why it was
added to the language. This looks like an experimental feature.

There was a discussion a few weeks back on how -extends changed in a
recent version and made some code incompatible. Use at your own risk.

--
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

Jesper Louis Andersen

unread,
Oct 29, 2012, 12:32:06 PM10/29/12
to Loïc Hoguin, erlang-q...@erlang.org

On Oct 29, 2012, at 11:46 AM, Loïc Hoguin <es...@ninenines.eu> wrote:

> On 10/29/2012 11:36 AM, Magnus Müller wrote:
>> In the never-ending quest of searching help to program as little as
>> possible, I found Erlang's -extends(Module) directive. There is little
>> documentation on it, which makes me believe that it is either
>> an unwanted or not well-supported feature of the language. Is this
>> correct? Would you recommend keeping away from it?
>
> As a general rule, keep away from anything undocumented. They are either internal code (that may change at any time) or experimental features (that may be removed at any time).
>
> I do not think it is used anywhere in OTP. I am not sure why it was added to the language. This looks like an experimental feature.
>
> There was a discussion a few weeks back on how -extends changed in a recent version and made some code incompatible. Use at your own risk.
>

Let me add that the dialyzer doesn't support -extends. So you have to choose between using an (undocumented) feature, which is presumably part of parameterized modules, or the dialyzer.

Jesper Louis Andersen
Erlang Solutions Ltd., Copenhagen
Reply all
Reply to author
Forward
0 new messages