Skip to content

Change module attribute name that stores internal protocol metadata#6012

Merged
whatyouhide merged 2 commits into
elixir-lang:masterfrom
samsondav:implement_impl
Apr 19, 2017
Merged

Change module attribute name that stores internal protocol metadata#6012
whatyouhide merged 2 commits into
elixir-lang:masterfrom
samsondav:implement_impl

Conversation

@samsondav
Copy link
Copy Markdown

@josevalim
Copy link
Copy Markdown
Member

@samphilipd thank you! What about @protocol_metadata for the name?

@samsondav
Copy link
Copy Markdown
Author

@josevalim done

- Changed from @impl to @protocol_metadata
- Required because we want to repurpose @impl - see elixir-lang#5734
end

defp detect_kind(module) do
impl = Module.get_attribute(module, :impl)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Author

@samsondav samsondav Apr 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@whatyouhide I agree. It reads a lot better renamed.

@whatyouhide whatyouhide merged commit 83f85f2 into elixir-lang:master Apr 19, 2017
@whatyouhide
Copy link
Copy Markdown
Member

Thanks a lot @samphilipd! 💟

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]
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants