-
Notifications
You must be signed in to change notification settings - Fork 3k
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
EEP-59 slogans #8030
Comments
I've been thinking about this for the last week and I think your suggestion is better than what we have now. I'll look into it and see if we can change it. Regarding the |
But doesn't that interfere with
That said, I'd also promote That said, instead of: -doc hidden. we'd have: -doc #{hidden => true}. Eventually, if you want to include undocumented and not-exported type you could do it easily: -doc #{hidden => false}.
-type not_exported() :: any(). |
It should be:
The rules are the same for functions and callbacks, except that the "or referenced" logic is not applied. In EEP-48, which is what EEP-59 targets, the "Doc" field in the tuple for each entry can be |
Makes sense and I'm not sure where
If i got it correctly "Signature" from EEP-48 is what "Slogan" is in EEP-59, right? Should we choose one of those names (given that semantics are equal ofc)? It's not part of the metadata either, but if it can be extracted from doc string, I don't see a reason why it couldn't be extracted from the meta map. Moving "Signature" to the map would now be backward incompatible because of the tuple, but we could move it to the map in EEP-59 and leave internal representation distinct from that. There already are keys that exist in EEP-48 metamap and not in EEP-59 anyways (and vice versa). |
It should indeed be "Signature". Thanks for noticing, not sure how I missed that.
Both EEP-48 and EEP-59 allow for any keys you want to be added to the metadata. EEP-48 defines the keys that are used across BEAM languages while EEP-59 defines keys used only in Erlang (or rather it should, the current EEP-59 does not define any keys). I've chosen to not list all the keys of EEP-48 in the Erlang Reference Manual, though maybe we should do that for clarity. One of the problems that I try to keep in mind when looking at the signature things is that in the future (maybe soon, or later, or maybe never) we want to be able to document function clauses and then using the signature to figure out which clause documentation belongs to could be one way. So I don't want to paint the implementation into a corner that I later would like to get out of. |
So it should never be manually set by the user, but is documented just so one does not set it by mistake (to use it in for a different task)?
Aha, you mean something like: -doc """
add(X,X) -> Y
First clause doc.
add(X,Y) -> Z
2nd clause doc.
""". ? If going that way, I'd consider adding Would it make sense to introduce EEP-59 implementation as an experimental feature? Because we may introduce something in OTP27 and conclude that it's a deal-breaker for something better in OTP28. The reason is that (from my point of view) something "experimental" have a higher chance of getting backward incompatible changes than something that is just introduced. |
yes. The documentation states "For any -type attribute this value is automatically set by the compiler and should not be set by the user."
It is indeed, but it ties into the signature discussion.
Maybe. We have until May to figure out if we want that or not. |
Okay, but can we change the docs to "This value is automatically set by the compiler and should not be set by the user"? Because, from the current docs, it's not clear that to do with this attribute for functions and callbacks, it only says that it's automatic for types and that is what totally confused me. I'll make a PR if you agree. |
I agree. |
One thing came to my mind while reading the documentation:
Seems like a "magical" behavior to me. Couldn't
slogan
be a reserved key in a function metadata? Seems like a natural fit. E.g.:EDIT:
or even better, use the same semantics as
equiv
:EDIT 2:
Maybe off topic, but I noticed that
exported
is a reserved key. Here it says that "For any -type attribute this value is automatically set by the compiler and should not be set by the user." - why isn't the same for functions? Is there a case where compiler can't figure out whether function/type is or isn't exported?The text was updated successfully, but these errors were encountered: