[erlang-questions] Module language for Dialyzer?
Dave Cottlehuber
dch@REDACTED
Mon Oct 7 10:13:59 CEST 2013
From: Anthony Ramine Anthony Ramine
Reply: Anthony Ramine n.oxyde@REDACTED
Date: 07. Oktober 2013 at 09:24:30
To: Siraaj Khandkar siraaj@REDACTED
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.
A+
Dave
More information about the erlang-questions
mailing list