Closed filmor closed 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:
get_value/1
is only intended for fetching values corresponding to my own reg objectsget_value/2
expects me to know which process holds the value, assuming it's an error if this is no longer true. As with get_value/1
, it expects the requested value to be there.lookup_value/1
does what you are asking for. It exits if you pass it a property, since these are not unique, or if given a name, no such key exists.lookup_values/1
will work for both names and properties, returning all matching [{Pid,Value}]
entries.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.
The following works as expected
The following however doesn't:
The problem is, that
get_value/1
will always look the value up in the current process whileget_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?