Hi,

The formatter currently accepts definitions of functions with no arguments 
(arity 0) with or without parens. This means that these two expressions are 
valid (format-wise) within the same codebase:

def main do
end

def main() do
end


To show real-life examples, I made a list of some functions in the Elixir 
codebase defined with or without parens:


*Without parens:*


   - Kernel.node/0 - 
   
https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/kernel.ex#L711
   - Regex.version/0 - 
   
https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/regex.ex#L215
   - Keyword.new/0 - 
   
https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/keyword.ex#L111
   - Map.new/0 - 
   https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/map.ex#L150
   - IO.ANSI.enabled?/0 - 
   
https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/io/ansi.ex#L42
   - Port.list/0 - 
   https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/port.ex#L294
   - System.argv/0 - 
   
https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/system.ex#L200
   - System.cwd/0 - 
   
https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/system.ex#L221
   - System.cwd!/0 - 
   
https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/system.ex#L242
   - All the /0 of System
   

*With parens:*


   - Kernel.make_ref/0 - 
   
https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/kernel.ex#L618
   - Kernel.self/0 - 
   
https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/kernel.ex#L803
   - Access.all/0 - 
   
https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/access.ex#L613
   - MapSet.new/0 - 
   
https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/map_set.ex#L57
   - File.cwd/0 - 
   
https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/file.ex#L1353
   - File.cwd!/0 - 
   
https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/file.ex#L1373
   

Is this flexibility in the style intended? I'm probably nitpicking, but it 
would be nice if one style is enforced. The same applies for function 
specifications.

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/665af8fd-45b0-411b-acb4-4ea03732f4f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to