[erlang-questions] Dialyzer and rpc:pmap
Kostis Sagonas
kostis@REDACTED
Wed Aug 31 11:32:31 CEST 2011
On 08/31/11 12:10, Stavros Aronis wrote:
> No, the problem lies in the spec of rpc:yield/1
>
> -spec yield(Key) -> {value, Val} | timeout when
> Key :: key(),
> Val :: (Res :: term()) | {badrpc, Reason :: term()}.
>
> yield(Key) when is_pid(Key) ->
> {value,R} = do_yield(Key, infinity),
> R.
>
> The return value is simply "Val" and not the union "{value, Val} |
> timeout". I guess somebody in the OTP team can fix that.
Stavros is right. This typo in the spec was introduced in R14B03 and
it's an obvious copy and paste error from functions nb_yield/[1,2] and
do_yield/2 which appear below yield/1 in the file. It should be fixed by
the OTP team.
While editing the rpc.erl file, and although this does not affect
Dialyzer in any way, perhaps a better way of writing the type of Val in
a situation like the above is without the "Res ::" part which does not
add any information whatsoever, IMO. It just makes the spec more bulky.
Kostis
More information about the erlang-questions
mailing list