<div dir="ltr">I don't think this is supported by dialyzer today, but it would indeed be a very valuable addition. It's a feature I would really appreciate myself.</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Dec 19, 2016 at 4:40 PM Sölvi Páll Ásgeirsson <<a href="mailto:solvip@gmail.com">solvip@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br class="gmail_msg">
<br class="gmail_msg">
(sorry if this is a duplicate, but I sent this message to the list<br class="gmail_msg">
last week, before subscribing to it, cannot find it anywhere and<br class="gmail_msg">
assumed it went to the bitbucket)<br class="gmail_msg">
<br class="gmail_msg">
I've searched, but I haven't found anything and I'm afraid of what I'm<br class="gmail_msg">
asking is impossible, but I thought I'd ask here as well.<br class="gmail_msg">
<br class="gmail_msg">
Is there a way for us to say that a type spec is describing a module<br class="gmail_msg">
that should implement a specific behaviour?<br class="gmail_msg">
<br class="gmail_msg">
That is, I want to do something like the following:<br class="gmail_msg">
<br class="gmail_msg">
-module(foo).<br class="gmail_msg">
-callback foo(bar) -> quux.<br class="gmail_msg">
<br class="gmail_msg">
Then I'll have a concrete implementation of this:<br class="gmail_msg">
<br class="gmail_msg">
-module(bar).<br class="gmail_msg">
-behaviour(foo).<br class="gmail_msg">
foo(bar) -> quux.<br class="gmail_msg">
<br class="gmail_msg">
In the third module, I'd like to spec a record so that I can state<br class="gmail_msg">
that a certain field of the record<br class="gmail_msg">
should contain an atom which is the name of a module implementing a behaviour:<br class="gmail_msg">
<br class="gmail_msg">
-module(quux).<br class="gmail_msg">
-record(state, { callback_mod = bar :: behaviour(foo) }).<br class="gmail_msg">
<br class="gmail_msg">
I'd then of course like Dialyzer to tell me if something is wrong.<br class="gmail_msg">
Can we do something like this? If not, would it be extremely<br class="gmail_msg">
difficult to add support for this? Where could I start?<br class="gmail_msg">
<br class="gmail_msg">
Thanks alot<br class="gmail_msg">
Sölvi Páll Ásgeirsson<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
erlang-questions mailing list<br class="gmail_msg">
<a href="mailto:erlang-questions@erlang.org" class="gmail_msg" target="_blank">erlang-questions@erlang.org</a><br class="gmail_msg">
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" class="gmail_msg" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br class="gmail_msg">
</blockquote></div>