uwiger / gproc

Extended process registry for Erlang
Apache License 2.0
1.07k stars 232 forks source link

Documentation reg_or_locate/1 has wrong return type #76

Closed peerst closed 9 years ago

peerst commented 9 years ago

Spec for reg_or_locate/1:

reg_or_locate(Key::key()) -> true

Correct would be:

reg_or_locate(Key::key()) -> {pid(), NewValue}

More documentation errors:

where and whereis_name return pid() | undefined

-> doc mentions "Otherwise this function will exit. " this is not the current behavior

While lookup_pid returns pid() or exits with badarg

This is not reflected in the doc so far, exiting is not mentioned

uwiger commented 9 years ago

@peerst, the function where/1 does exit if called with anything but a name or aggregated counter, which is what the doc says.

2> application:start(gproc).
ok
3> gproc:where({n,l,a}).
undefined
4> gproc:where({c,l,a}).
** exception error: bad argument
     in function  gproc:where/1
        called as gproc:where({c,l,a})
5> gproc:where({a,l,a}).
undefined
6> gproc:where({p,l,a}).
** exception error: bad argument
     in function  gproc:where/1
        called as gproc:where({p,l,a})

The other issues have been fixed. Thanks.

peerst commented 9 years ago

Oh yeah, did read it hastily