Skip to content
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

Turn EVM.Configuration into a behaviour #451

Merged
merged 1 commit into from
Sep 26, 2018

Conversation

germsvel
Copy link
Contributor

@germsvel germsvel commented Sep 26, 2018

What?

We turn EVM.Configuration into a Behaviour instead of a protocol.

Why?

Behaviours and Protocols are two ways to implement polymorphism in
Elixir. When we want a module to behave the same way as other modules,
we want it to satisfy a behaviour (e.g. GenServer). When we want to
create a somewhat generic set of operations on different types, we use
protocols (e.g. Enumerable working on lists, ranges, etc).

Since the EVM.Configuration lands on the first camp, we should use a
Behaviour for it. This has the side-effect of cleaning up some
dialyzer errors that made no sense previously, such as an Atom not
having the EVM.Configuration protocol implemented.

Copy link
Member

@ayrat555 ayrat555 left a comment

Choose a reason for hiding this comment

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

LGTM

What?
=====

We turn `EVM.Configuration` into a Behaviour instead of a protocol.

Why?
=====

Behaviours and Protocols are two ways to implement polymorphism in
Elixir. When we want a module to behave the same way as other modules,
we want it to satisfy a behaviour (e.g. `GenServer`). When we want to
create a somewhat generic set of operations on different types, we use
protocols (e.g. `Enumerable` working on lists, ranges, etc).

Since the `EVM.Configuration` lands on the first camp, we should use a
`Behaviour` for it. This has the side-effect of cleaning up some
dialyzer errors that made no sense previously, such as an `Atom` not
having the `EVM.Configuration` protocol implemented.

Co-authored-by: Matthew Sumner <matt.m.sumner@gmail.com>
@germsvel germsvel force-pushed the gv-mms-behaviours-not-protocols branch from 718e87f to 520a374 Compare September 26, 2018 18:39
@germsvel germsvel merged commit 4f089c1 into master Sep 26, 2018
@ghost ghost removed the status: in progress label Sep 26, 2018
@germsvel germsvel deleted the gv-mms-behaviours-not-protocols branch September 26, 2018 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants