-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export oft-used types #2994
Export oft-used types #2994
Conversation
We discussed this in the PS team, and we feel that the exports are motivated. We would however prefer that the type Or just realized it is probably because of the inclusion of the internal undefined. Maybe it should be changed to mfa() | sup_internal() which can be specified as undefined. I just remembered after reading the docs again that is used for temporary processes instead of saving potentially big argument lists for no purpose. That could make it clearer that undefined is nothing that should be used by the user. |
Export types that will be convenient for client code where doing so will not expoose implementation details or promote bad practices. These are the types exported: ets.erl: - type() :: set | ordered_set | bag | duplicate_bag. re.erl: - mp() :: {re_pattern,_ ,_ ,_ ,_ }.* supervisor.erl: - `restart() :: 'permanent' | 'transient' | 'temporary'.` | undefined}.` - `shutdown() :: 'brutal_kill' | timeout().`
c049e0d
to
a26e939
Compare
@IngelaAndin , I updated the PR to not export |
We are not through the internal discussion about when and why to export types in general yet. Will try to finish that soon.
|
What is the best way for me to contribute and to follow the work? Since you're taking a broader look at the general problem, would it be easier for you if I close this PR and open an issue in the bug tracker instead? |
We have code that takes regexes as parameters and then uses the fwiw, my two cents is there is sufficient reason to expose a type (or an opaque wrapper of a type) when the type appears in the signature of an exported function. Otherwise it can be hard to spec functions that use those exported functions. |
Yes I think it is a good idea to close the PR and that you create an issue per API where you think there are types that should be exported. In this case one for |
Thanks @KennethL , I've converted to issues: |
Export more types that meet these criteria:
used in specs of public functions of their respective
modules.
The types are:
ets.erl:
supervisor.erl:
shutdown() :: 'brutal_kill' | timeout().
The reason for this change is to fix the status quo, which is
that teams either must:
to manually keep the types in sync.
or less accuracy from code analysis tools. For example,
Dialyzer will either warn or treat the types as
term()
.