[erlang-questions] [Dialyser] Type parametrized behaviours

Stavros Aronis <>
Tue Apr 24 20:10:09 CEST 2012


Hi Francesco,

Do you mean that after your update these types have to be moved within the 
behaviour file itself? If this is the case, you could export them using the 
"-export_type" attribute and then use them as remote types: 
"behaviour_module:type_name()". You can use them in this way in both specs 
and other -type definitions and at least Dialyzer won't have any problem at 
all.

Stavros

On Tuesday, April 24, 2012 5:42:58 PM UTC+3, Francesco Mazzoli wrote:
>
> Hi,
>
> I have recently updated some code to use the new callback signatures for 
> behaviours. Before that, we simply used a .hrl file that we included in 
> each implementing module.
>
> While hacky, the old approach had an advantage: we could include in the 
> .hrl specs some types that were to be defined in the including file, and 
> then used in type signatures.
>
> It would be useful to be able to parametrize behaviours by type more 
> nicely, since most behaviours specs are dominated by 1 or 2 types 
> (classically some kind of state) and as of now no typechecking takes 
> place on those types. That might be achieved with some pre-processor 
> directive, e.g. -behaviour_type(whatever).
>
> What do you think?
>
> Francesco.
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
On Tuesday, April 24, 2012 5:42:58 PM UTC+3, Francesco Mazzoli wrote:
>
> Hi,
>
> I have recently updated some code to use the new callback signatures for 
> behaviours. Before that, we simply used a .hrl file that we included in 
> each implementing module.
>
> While hacky, the old approach had an advantage: we could include in the 
> .hrl specs some types that were to be defined in the including file, and 
> then used in type signatures.
>
> It would be useful to be able to parametrize behaviours by type more 
> nicely, since most behaviours specs are dominated by 1 or 2 types 
> (classically some kind of state) and as of now no typechecking takes 
> place on those types. That might be achieved with some pre-processor 
> directive, e.g. -behaviour_type(whatever).
>
> What do you think?
>
> Francesco.
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120424/09599d0c/attachment.html>


More information about the erlang-questions mailing list