[erlang-questions] Fourth draft of EEP 44 - Additional preprocessor directives
Michael Truog
mjtruog@REDACTED
Thu Jun 2 02:29:23 CEST 2016
On 10/29/2015 06:08 AM, Björn Gustavsson wrote:
> Here is the fourth draft with more clarifications.
>
> There is also a minor correction in the reference implementation.
>
> http://www.erlang.org/eeps/eep-0044.html
> https://github.com/erlang/eep/blob/master/eeps/eep-0044.md
>
> /Björn
>
It is unclear if these changes will make it into 19.0. Will any of EEP44 be available?
The is_deprecated/3 described by EEP44 seems unusable due to being focused on Erlang/OTP deprecated functions. Could we instead implement it with usage of the module_info function so that anyone can easily use is_deprecated/3? I don't think it requires checking the exports list (if someone is checking an unexported function, that is their problem that they should discover later in their source code). I have an example implementation below:
is_deprecated(Module, Function, Arity) ->
Attributes = Module:module_info(attributes),
lists:any(fun(Attribute) ->
case Attribute of
{deprecated, [_ | _] = Deprecated} ->
lists:any(fun(Deprecate) ->
case Deprecate of
{Function, FunctionArity, _}
when FunctionArity == Arity;
FunctionArity == '_' ->
true;
{Function, FunctionArity}
when FunctionArity == Arity;
FunctionArity == '_' ->
true;
_ ->
false
end
end, Deprecated);
_ ->
false
end
end, Attributes).
More information about the erlang-questions
mailing list