Change module attribute name that stores internal protocol metadata#6012
Merged
Conversation
samsondav
commented
Apr 18, 2017
- Changed from @impl to @__implements_protocols_for
- Required because we want to repurpose @impl - see Introduce @impl attribute and improve defoverridable #5734
Member
|
@samphilipd thank you! What about @protocol_metadata for the name? |
846fbdd to
b329e9a
Compare
Author
|
@josevalim done |
- Changed from @impl to @protocol_metadata - Required because we want to repurpose @impl - see elixir-lang#5734
b329e9a to
1bdc5a9
Compare
josevalim
approved these changes
Apr 18, 2017
whatyouhide
reviewed
Apr 18, 2017
| end | ||
|
|
||
| defp detect_kind(module) do | ||
| impl = Module.get_attribute(module, :impl) |
Member
There was a problem hiding this comment.
For peace of mind, maybe it's a good idea to rename this variable as well (so we don't have this impl raising questions here). Wdyt?
Author
There was a problem hiding this comment.
@whatyouhide I agree. It reads a lot better renamed.
whatyouhide
approved these changes
Apr 19, 2017
Member
|
Thanks a lot @samphilipd! 💟 |
samsondav
commented
Apr 24, 2017
| Module.register_attribute(__MODULE__, :impl, persist: true) | ||
| @impl [protocol: @protocol, for: @for] | ||
| Module.register_attribute(__MODULE__, :protocol_metadata, persist: true) | ||
| @protocol_metadata [protocol: @protocol, for: @for] |
Author
There was a problem hiding this comment.
@josevalim Do you think we should document this somewhere? It seems unlikely but plausible that a user could accidentally use this module for their own purposes and be very surprised at the resulting breakage.
For completeness I think it would be nice to list all the "blacklisted" module variables somewhere.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.