Files
eiffel-org/documentation/25.02/eiffel/Coding_Standards/Eiffel-Coding-Standard.wiki
eifops 1a0353ee6c Created Documentation branch for 25.02
git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@2485 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
2025-02-06 19:48:22 +00:00

94 lines
1.4 KiB
Plaintext

[[Property:modification_date|Mon, 03 Dec 2018 10:00:43 GMT]]
[[Property:publication_date|Tue, 30 Oct 2018 14:56:21 GMT]]
[[Property:uuid|0CD0A1B2-42F8-48E0-B419-61B4DC076C1B]]
[[Property:weight|2]]
[[Property:title|Eiffel Coding Standard]]
==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.
A sample of proper formatting of code:
<e>note
description: "Descr...."
date: "$date: $"
class A
inherit
B
rename
f as g
end
create
make
feature {NONE} -- Initialization
make (a: INTEGER)
-- Initialize Current with `a`.
do
end
invariant
a_positive: a > 0
end</e>
==Style==
* If instructions:
<e>if expr1 then
...
elseif expr2 then
...
else
...
end</e>
If expressions are very long, break them on conjunctions as in:
<e>if
expr1 and then
expr2
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 punctuation, we always have
** a space before, and no after `(`
** no space before, and space after `)` `,` `:` or `;`
<e>require
a_tag: query (a, b, c) or other_query (c, d)
local
i: INTEGER; j: INTEGER
</e>