[erlang-patches] Add support for dependencies Makefile

Björn-Egil Dahlberg <>
Tue Dec 15 10:18:48 CET 2009

Håkan Mattsson wrote:
> The coding style that Björn describes below applies for the compiler
> application. Other OTP applications may have other styles. Try to
> always follow the existing coding style in the module that you change.
> Ask the application responsible if you are hesitant.

Agreed. Several coding styles exists in otp but the number one rule is 
"follow the local style".

> Several of the coding style issues that Björn brought up are common for
> all applications in OTP. But when it comes to the use of import from other
> modules and spaces around '=' and ','  there is no commonly adopted
> style in OTP.

I would prefer readability over concatenated one-liners. Spaces around 
'=' and ',' would improve readability in *my* view but it would break 
the #1 rule in this case.

I think that we need to put up the Coding Conventions page soon.

// Björn-Egil

> /Håkan
> ---
> Håkan Mattsson (uabhams)
> Erlang/OTP, Ericsson AB
> 2009/12/15 Björn Gustavsson <>:
>> The code style needs some work before we can consider including it in
>> Erlang/OTP. Here are the major things I saw when glancing at your
>> code:
>> We always write two percent characters ("%%"), not only one ("%") for
>> comment lines not preceded by code.
>> We don't use spaces in around '=' in function heads. We prefer :
>>   makedep(#compile{code=Code,options=Opts}=St)
>> In the compiler application, we import functions from the lists
>> module; we don't write lists:member(...).
>> In the compiler application, we don't have spaces after commas in
>> terms (but we do put spaces after commas in function calls).
>> In the same function, please use either proplists:get_value/2 or
>> member/2 consistently. (I recommend proplists:get_value/2.)
>> We write variables without underscores: LineLen, not Line_Len.
>> Don't use throw from inside a try block in makedep_output/1. As far as
>> I can see, the only function call that you will need to catch is the
>> one to io:fwrite/2, so just put that function call in a try block.
>> Don't use library calls like this
>>            File1 = case lists:prefix("./", File) of
>>                true  -> lists:nthtail(2, File);
>>                false -> File
>>            end,
>> when matching will do
>>            File1 = case File of
>>                "./"++File2 -> File2
>>                _ -> File
>>            end,
>> (NOT TESTED, but it should work)
>> --
>> Björn Gustavsson, Erlang/OTP, Ericsson AB
> ________________________________________________________________
> erlang-patches mailing list. See http://www.erlang.org/faq.html
> erlang-patches (at) erlang.org

More information about the erlang-patches mailing list