[erlang-questions] Specs for optional callbacks (try 2)
Robert Virding
rvirding@REDACTED
Sun Sep 28 09:11:46 CEST 2014
Just to throw something completely different and definitely not backwards
compatible I would prefer something like:
-callback([foo/2,bar/4]).
-optional_callback([bar/3,boo/14]).
foo(...) -> ... .
bar(...) -> ... .
baz(...) -> ... .
boo(...) -> ... .
This because it mirrors how -export(). behaves and does not push the
information down into the actual definition. I think not seeing it at the
start of the module is a bad option as it means I have to step down into
the module to see what it exports and, in this case, what are the
callbacks. You have to delve down into the module to find this "global"
information. I find it very annoying with languages that do this, which is
why I purposely followed erlang when doing LFE.
Yes, I know it is too late to change it. Is it? Maybe a parse transform to
get it right?
Robert
On 25 September 2014 05:38, Loïc Hoguin <essen@REDACTED> wrote:
> On 09/25/2014 03:01 PM, Hans Bolinder wrote:
>
>> [Loïc Hoguin:]
>>
>>> I didn't get any reply on my previous question almost 2 years ago here:
>>> http://erlang.org/pipermail/erlang-questions/2013-January/071763.html
>>>
>>
>> I missed your original question, otherwise I would have replied to it.
>>
>
> No worries. :)
>
> There is an implementation in Erlang/OTP 18, see commit 683a293, using
>> the second syntax suggested by Kostis, -optional_callbacks/1.
>>
>
> Woot!
>
> This looks great. I guess I'll just have to wait now and play with it a
> few weeks before 18 gets released.
>
> Thanks for the heads up!
>
> --
> Loïc Hoguin
> http://ninenines.eu
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140928/0d482d6e/attachment.htm>
More information about the erlang-questions
mailing list