[erlang-questions] [Dialyser] Type parametrized behaviours
Wed Apr 25 12:14:16 CEST 2012
On Tue, Apr 24, 2012 at 02:17:06PM -0700, Stavros Aronis wrote:
> Ok, I understand your original approach now. It is indeed clever and
> reduces duplication.
Just for purposes of another example, one which shows several
narrowings, the same technique is used heavily in erlando.
Note that some of those refinements (eg maybe_m) also bring in the specs
and that both sets of specs make use of the *same* type parameter name.
The point is that it allows you to define the specs with named
polymorphism and then to narrow those types as the specialisations
require. In the case of erlando, the narrowing still leads to
polymorphic types, though normally narrower, whereas the rmq example
reduced the types to fully ground types.
More information about the erlang-questions