Closed spieker closed 6 years ago
I think we can extend Pipette.Client
to accept two different inputs on push/3
for example:
def push(pid, %IP{} = ip, opts \\ []) do
GenServer.call(pid, {:push, ip, opts})
end
def push(pid, value, opts \\ []) do
GenServer.call(pid, {:push, IP.new(value), opts})
end
And about changing IP.new
to also handle IP.update
, I would argue to keep the method signature of IP.new
and IP.update
small and separate.
It might be much easier to comprehend and read the documentation when those are two separate functions on IP
.
Other elements in Elixir handle it the same way, so that Map.new
and Map.put
are distinct.
👍
The client methods
push
andcall
currently taking a value and wrapping it inside an IP, also if the value already is an IP. In case ofcall
, thereply_to:
field is set an the new IP as well.@Overbryd Instead of changing the signatures of the client functions, what do you think about removing the
IP.update
function and have theIP.new
function take care of updating as well, depending on the input. The signature ofIP.new
would then look like this: