uwiger / gproc

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

Interface weirdness in get_value/1 #118

Closed filmor closed 8 years ago

filmor commented 8 years ago

The following works as expected

% some process
gproc:reg({n, l, some_proc}, [], [{value, value}]).

% some other process
gproc:get_attribute({n, l, some_proc}, value) =:= value.

The following however doesn't:

% some process
gproc:reg({n, l, some_proc}, value).

% some other process
gproc:get_value({n, l, some_proc}) =:= value.

The problem is, that get_value/1 will always look the value up in the current process while get_attribute/2 will do the smarter thing and look up the attribute on a process depending on the type of the registration, in particular for names it will always give you the attribute value for the current name-holder.

Is this intended behaviour or just an oversight? Would a PR changing get_value/1 to similar semantics be accepted?

uwiger commented 8 years ago

It might be weird behavior, but it is in line with the documentation. I will confess that I can't account for how I was thinking at the time, but here's a try:

filmor commented 8 years ago

Oh, I guess I forgot about lookup_value/1, sorry about that. Still, I'm not using lookup_attribute and still get the "lookup" behaviour there.

The explanation is fine by me though, from my side this can be closed.