[erlang-questions] Somebody please correct my -callback understanding
Wed Dec 14 20:03:39 CET 2011
2011/12/14 Damian Dobroczyński <>:
> Dnia śro, 14 gru 2011, 19:52:17 Damian Dobroczyński pisze:
>> Dnia śro, 14 gru 2011, 19:38:33 Daniel Luna pisze:
>>> 2011/12/14 Damian Dobroczyński <>:
>>>> Wow, It's a miracle! I've just found the answer and (what I understand)
>>>> a bug. IT IS "-behavior (...)" which is perfectly understood by the
>>>> compiler but not by by the dialyzer! Dialyzer expects "-behaviour (...)"
>>>> (note the different spelling).
>>> This is not a bug. Erlang has always used 'behaviour' (and
>>> 'behaviour_info'). See
>>> As a side note, Erlang allows for any user defined elements starting with -.
>>> If you for example add the following line to your code
>>> then this is fully legal Erlang, and its effect is seen if you run
>> From Erlang Reference Manual:
>> The atom Behaviour gives the name of the behaviour, which can be a user
>> defined behaviour or one of the OTP standard behaviours gen_server,
>> gen_fsm, gen_event or supervisor.
>> The spelling behavior is also accepted."""" <--- HERE
>> It's a bug. Besides as I mentioned, the compiler perfectly understand
>> the attribute "-behavior" giving me warnings about missing callbacks.
>> So, compiler understand and behave correctly with "-behavior" -
>> dialyzer don't.
>> (Unfortunately (or maybe not) my code if full of "behaviors" ;) just
>> because it is accepted and understood not even deprecated).
>> -- D.
> I've just looked into "Erlang. Programming" by Cesarini & Thompson
> (2009), page 271, an example of gen_server (usr.el listining):
> Well, thats enough for me to be completely comvinced it's not a weird
> thing to write "-behavior (...)". I think it's in common, especially
> for Americans.
You're right. My bad.
More information about the erlang-questions