Difference between revisions of "Eiffel Coding Standard"

(Style)
Line 14: Line 14:
 
else
 
else
 
     ...
 
     ...
end
+
end</e>
</e>
+
 
 +
If expressions are very long:
 +
<e>if
 +
    expr1
 +
then
 +
    ...
 +
end</e>
 +
 
 +
* Loop instructions:
 +
<e>from
 +
    ...
 +
until
 +
    ...
 +
loop
 +
    ...
 +
end</e>
 +
 
 +
* Inspect instructions:
 +
<e>inspect expr
 +
when val1 then ....
 +
else
 +
    ...
 +
end</e>
 +
 
 +
or
 +
 
 +
<e>inspect
 +
    expr
 +
when val1 then
 +
    ...
 +
else
 +
    ...
 +
end</e>
 +
 
 +
* For ponctuations, we always have a space before '''(''' and a space after ''')''', ''',''', ''':''', or ''';''':
 +
<e>require
 +
  a_tag: query (a, b, c) or other_query (c, d)
 +
local
 +
  i: INTEGER; j: INTEGER</e>

Revision as of 23:55, 1 August 2013

Language consideration

  • Do not put a blank line between
  • create and creation instructions
  • inherit and parent clauses
  • Do not use assertion clauses without tag names.

Style

  • If instructions:
if expr1 then
    ...
elseif expr2 then
    ...
else
    ...
end

If expressions are very long:

if
    expr1
then
    ...
end
  • Loop instructions:
from
    ...
until
    ...
loop
    ...
end
  • Inspect instructions:
inspect expr
when val1 then ....
else
    ...
end

or

inspect
    expr
when val1 then
    ...
else
    ...
end
  • For ponctuations, we always have a space before ( and a space after ), ,, :, or ;:
require
   a_tag: query (a, b, c) or other_query (c, d)
local
   i: INTEGER; j: INTEGER