sasa1977 / exactor

Helpers for simpler implementation of GenServer based processes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generate typespecs as well

seivan opened this issue · comments

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})

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.