Skip to Content.
Sympa Menu

sm-discuss - [SM-Discuss] The Great E-mails: part 1 (General)

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Vlad Glagolev <stealth AT sourcemage.org>
  • To: Source Mage Discussion <sm-discuss AT lists.ibiblio.org>
  • Subject: [SM-Discuss] The Great E-mails: part 1 (General)
  • Date: Sat, 29 Aug 2009 03:35:47 +0400

Okay, let's talk about some things I've been thinking since 2003, when I
started to look into the spell's structure.

Yes, it's all about formatting, formatting standards, what do we have and
what would we have.
Please bring some of your thoughts and opinions. They are really appreciated.

This will be a series of discussion, about the most important files in
(almost) every spell.
This is also a small RFC of my opinion ("constructed" by many years and work
with programming in several
languages like C/C++, Shell script, and Python and several projects like T2,
OpenBSD, and Lunar-Linux).

I think we still need some standartisation for the formatting (like we have
aligning in DETAILS).

But, first of all, let's start talking about the general things in formatting:

1. Lines of code in every file (DETAILS, ChangeLog, HISTORY, INSTALL,
DEPENDS, etc.) should have limits for the length (80 chars), this is a common
practice.
2. There's no recommendation for quotes: like in Python, both ' and " are
accepted and can be used by a developer.
3. In variables, extra stuff shouldn't be put. Like quotes and curly brackets
(braces). Only where it's really needed:
- {, } in variables like: ${SOURCE/-//} (bash patterns), ${SOURCE}_file
(underscore in name), but not in regular $SPELL-$VERSION, etc.
- ", ' in variables which can contain spaces, for example "$INSTALL_ROOT". As
it's user-defined, it can contain spaces in full path, so it's a good idea to
quote it.
4. UPPERCASE sub-dependencies in SUB_DEPENDS and PRE_SUB_DEPENDS (for
example, I fixed it for python3 spell, at least, but python remains..).
5. double-spaces in constructions if-else, etc.: use double-spaces (like 4
spaces in Python, tabs in C++) to align the blocks of code after a new line.
6. "then", like "do" should remain on the same line as "if" and "while"
accordingly.
7. Use bash power while creating dirs, using cycles, etc. to minimize the
code, for example: mkdir -p dir/{braces,are,good} instead of mkdir -p
dir/braces dir/are dir/good, or even worse: mkdir -p dir/braces && mkdir
dir/are && mkdir dir/good.

Will be waiting for your comments.

--
Dont wait to die to find paradise...
--
Cheerz,
Vlad "Stealth" Glagolev

Attachment: pgpLcw6QVkxwp.pgp
Description: PGP signature




Archive powered by MHonArc 2.6.24.

Top of Page