[erlang-questions] type specification
Zoltan Lajos Kis
Fri Jul 2 19:30:21 CEST 2010
On 7/2/2010 6:41 PM, Kostis Sagonas wrote:
> Serge Aleynikov wrote:
>> Can user-defined type specification be imported from or referenced to
>> another module?
>> E.g. if I have a function that returns date/time value in the same
>> format as calendar:now_to_local_time/1 whose type t_datetime1970() is
>> defined in the calendar module, what would the -spec of my function be:
>> -spec local_time() -> ???
>> local_time() ->
> If the type is exported (cf. the new -export_type attribute) then what
> you want to write is as simple as:
> -spec local_time() -> calendar:t_datetime1970().
> In this particular case, the t_datetime1970() is not exported, so you
> either need to clone it in your module or send a request to the
> module's maintainer to export this type.
Could you explain how the new export_type attribute relates to the
In R14A it seems that if I define an opaque type (without exporting it),
and try to use it in another module, dialyzer emits an unknown type warning.
If I export the type the warning is not emitted, but the type is not
treated as opaque anymore...
More information about the erlang-questions