[erlang-questions] Module language for Dialyzer?

Loïc Hoguin <>
Mon Oct 7 10:23:48 CEST 2013

On 10/07/2013 10:13 AM, Dave Cottlehuber wrote:
> From: Anthony Ramine Anthony Ramine
> Reply: Anthony Ramine 
> Date: 07. Oktober 2013 at 09:24:30
> To: Siraaj Khandkar 
> Subject:  Re: [erlang-questions] Module language for Dialyzer?
>> I am being serious and I don't see how behaviours alone relate more to ML functors than to ML signatures without parameters, as a behaviour can't be parameterized.
>> I also don't see where is the inversion, nor what you can do with ML interfaces that you can't do with behaviours.
>> An example would be great.
>> Le 7 oct. 2013 à 05:51, Siraaj Khandkar a écrit :
>>> I hope you're not being serious, because that would be abstraction inversion. Behaviour is a more specific concept.
>> --
>> Anthony Ramine
> As a practical example, there are many (5? 8?) json encoders in the erlang community, and an additional one as part of R17 via maps (if I read Joe's new book correctly).
> How would you implement a consistent interface (a protocol) across those today, to allow users to switch between (say) native R17, erlang-only jsx, and nif-driven jiffy?
> Today I'd guess you would need to write a behaviour and then a bunch of shims between each existing encoder such that it matches the behaviour. Or have an hrl file full of macros.

I don't understand. Wasn't it said that the type is opaque? Not the case 
with JSON libs, you get a structure with a known type that you will want 
to and will manipulate directly.

You don't have a consistent interface for those libs specifically 
because of that. You could, but it would make manipulating the data too 
awkward to be any good.

Loïc Hoguin
Erlang Cowboy
Nine Nines

More information about the erlang-questions mailing list