[erlang-questions] Typespecs export not working as intended?

Eric Merritt ericbmerritt@REDACTED
Mon Apr 18 16:06:20 CEST 2011


I am actually surprised that dialyzer isn't complaining. For this
particular topic I don' think there should be a difference between
compiled and source. However, my knowledge there is low. One of the
dialyzer folks will have to chime in to give you a definitive answer.

On Mon, Apr 18, 2011 at 8:56 AM, Loïc Hoguin <essen@REDACTED> wrote:
> Thanks.
>
> In this case I am running dialyzer on the source and it isn't
> complaining. Is there a difference between source and compiled code
> checking for dialyzer maybe?
>
> I'd really like to get dialyzer to complain some more. ;)
>
> On 04/18/2011 03:31 PM, Eric Merritt wrote:
>> Loďc,
>>
>> This is expected behaviour. You get the exact same behaviour with
>> function calls. Basically, the remote types are not checked until
>> evaluation time. In this case, that is when dialyzer or some other
>> tool goes through and makes use of the specs. Erlang is a late binding
>> language, both in function call and type references.
>>
>> Eric
>>
>> On Mon, Apr 18, 2011 at 6:03 AM, Loďc Hoguin <essen@REDACTED> wrote:
>>> Hello,
>>>
>>> I have ran into a weird issue while refactoring the type specs in a project.
>>>
>>> It seems types in a module can be used even if they are not exported
>>> using export_type. Neither of the compiler or dialyzer are complaining
>>> about it.
>>>
>>> For example, module a declares a type my_type(), module b uses it with
>>> a:my_type(), no export_type in module, yet it still works.
>>>
>>> Is that normal? The documentation clearly states that types should be
>>> exported.
>>>
>>> --
>>> Loďc Hoguin
>>> Dev:Extend
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>
>
> --
> Loďc Hoguin
> Dev:Extend
>



More information about the erlang-questions mailing list