[erlang-questions] Re: Using -spec for callbacks when defining behaviours

Richard O'Keefe ok@REDACTED
Thu Mar 18 02:23:34 CET 2010


>>
>> behaviour_info(callbacks_with_types) ->
>>    [{foo, 1, "-spec foo(A) -> A."},
>>     {bar, 0, "-spec bar() -> 'ok'."}];
If the string can only be a spec,
  - is "-" required or optional?
  - is "spec" required or optional?
  - is "." required or optional?
  - the function name has to appear twice,
    is the second appearance required or optional?

So could this be

behaviour_info(callbacks_with_types) ->
     [ {foo, 1, "(A) -> A"}
     , {bar, 0, "() -> 'ok'"}
     ];


More information about the erlang-questions mailing list