[erlang-questions] Erlang 19 callbacks aren't attributes?

Ryan Stewart zzantozz@REDACTED
Tue Jan 24 04:04:48 CET 2017


On Mon, Jan 23, 2017 at 6:28 AM Björn Gustavsson <bjorn@REDACTED> wrote:

> The change was intentional, but we did not foresee that it would
> cause problems.
>
> There is no formal documentation exactly which attributes should
> appear in module_info(attributes). A long time ago, all attributes
> except 'module', 'export', 'import', 'file', and 'record' were included.
>
> Well, to that point, the following appears on the Modules reference page (
http://erlang.org/doc/reference_manual/modules.html):

"Any module attribute can be specified. The attributes are stored in the
compiled code and can be retrieved by calling
Module:module_info(attributes), or by using the module beam_lib(3) in
STDLIB."

The most straightforward understanding of that has to be that all
attributes are equally accessible in both places.

When the dialyzer attributes 'type', 'spec', and 'opaque' were introduced
> we decided not to include them to reduce the code size.
>
> Since 'callback' and 'optional_callback' are attributes that
> are used by dialyzer, we decided that they too should be
> excluded (for consistency).
>
> That makes sense in a way, but at the same time, it seems very odd for all
of these things to be "attributes", and yet only some of them appear when
you ask the language for the attributes of a module. Regardless of the
intended use of an attribute, why would the platform lie about whether or
not an attribute is present?

Also, what do you mean by "excluded"? As I pointed out in my post, the
attributes are still present in the abstract code. I don't understand
what's saved by having them in one place but not the other.

Ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170124/de7fe394/attachment.htm>


More information about the erlang-questions mailing list