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

Don't put multiple function defs together #23

Closed
wants to merge 1 commit into from
Closed

Don't put multiple function defs together #23

wants to merge 1 commit into from

Conversation

tallakt
Copy link

@tallakt tallakt commented Dec 10, 2014

I think this is more like what you would find in elixir source code...

@Gazler
Copy link
Collaborator

Gazler commented Dec 11, 2014

The elixir code base seems to do the following for single line clauses:

def foo([]), do: true
def foo(nil), do: false
def foo(_), do
  #something else
end

As seen in https://github.com/elixir-lang/elixir/blob/2fb232a5318d8ea9db38dc2fc3dc81063a6b6304/lib/elixir/lib/list.ex#L322

And split multiple definitions with different clauses by a newline such as https://github.com/elixir-lang/elixir/blob/2fb232a5318d8ea9db38dc2fc3dc81063a6b6304/lib/elixir/lib/list.ex#L295 (as proposed here)

@tallakt
Copy link
Author

tallakt commented Dec 11, 2014

Yeah thats probably more precise

@mschae
Copy link
Contributor

mschae commented Mar 3, 2015

Yeah I am in favour of keeping it as suggested right now.

I personally had to adjust to multiple function definitions not being separated, but once I got used to it it made reading code easier because it shows right away "what belongs together".

@jtmoulia
Copy link

👍 for what @Gazler said -- run together for single line clauses, split for multi-line clauses.

@nessamurmur
Copy link
Collaborator

👍 for what @Gazler said -- run together for single line clauses, split for multi-line clauses.

Another 👍.

Anyone want to open a PR for that?

Gazler pushed a commit to Gazler/elixir_style_guide that referenced this pull request Mar 23, 2015
@Gazler
Copy link
Collaborator

Gazler commented Mar 23, 2015

@niftyn8 @jtmoulia I have opened the pull request, would appreciate feedback on my addition of not mixing single-line and multi-line for more than one multi-line def.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants