Exporting gen_server name and ref types

Nicolas Martyanoff khaelin@REDACTED
Sun Jul 12 14:07:07 CEST 2020


Hi,

I just realized that multiple gen_server types are not available:

- For refs, gen_server:ref/0 exists but is not exported.

- For names, gen_server does not specify any type, but call functions from the
  gen module which uss gen:emgr_name(), which is also not exported.

- Return values for gen_server:start are described by gen:start_ret/0 which is
  not exported.

It is inconvenient because writing type specifications for functions wrapping
gen_server functions (e.g. all start_link functions which end up calling
gen_server:start_link) means copy/pasting these non-trivial types everywhere.

Additionally, I believe gen_server:request_id/0 should also be exported, it is
common to pass request ids around and it is therefore useful to have the
precise type available.

Would you consider a patch which would export gen_server:ref/0 and
gen_server:request_id/0, and add/export gen_server:name/0 and
gen_server:start_ret/0 (based on the existing gen types) ?

Regards,

-- 
Nicolas Martyanoff
http://snowsyn.net
khaelin@REDACTED


More information about the erlang-questions mailing list