Generate typespecs as well
seivan opened this issue · comments
Seivan commented
How would you feel about adding support for typespecs?
defcast inc(x :: integer), state: state, do: new_state(state + x)
would generate
@spec inc(x :: integer)
def inc(pid, x), do: GenServer.cast(pid, {:inc, x})
Saša Jurić commented
I think that for your example, I prefer adding the @spec
manually. The reason is that such approach is consistent with how specs are supplied in other modules.
With your proposal, we'd have to use both "inlined" specs and the explicit ones. In some cases even the ExActor powered modules would need to contain the combination of both styles. I fear that this would cause more confusion and so I'm not sure it's worth supporting this.