Over the last few months I drove an effort to publish a new Object Pascal style guide for today's Delphi language. From the preface:

"This document is an updated version of the classic Object Pascal style guide, originally curated by Charlie Calvert for Borland at the time Delphi was originally released. The updated version has been curated by Delphi Product manager Marco Cantu, with contributions from the internal R&D team, Delphi MVPs, and the Delphi community at large."

The text is not a language guide, rather it covers the use of white space and formatting when writing code -- something the compiler generally ignores. Nothing is mandatory here, this is just a recommendation to favor readability. Following these rules is a requirement for our own internal team and any contributor.

You can find the style guide at http://docwiki.embarcadero.com/RADStudio/Sydney/en/Delphi's_Object_Pascal_Style_Guide .
This is the document index:

  • Introduction
  • General Rules: Identifiers, Keywords, Indentation
  • Source Code Files, Units and Their Structure
  • White Space Usage
  • Comments
  • Statements
  • Type Declarations

I'll end this blog posting the short introduction:

While the Delphi compilers generally ignore any whitespace and allow for a lot of flexibility in the way a developer writes code, for readability and maintainability of the source code, Embarcadero has defined a set of guidelines used by the internal R&D and any developer involved with the project. We recommend the Delphi community at large to adopt this coding and formatting style.

The introduction of the original version of this document expresses this nicely:

“Object Pascal is a beautifully designed language. One of its great virtues is its readability. These standards are designed to enhance that readability of Object Pascal code. When developers follow the simple conventions laid out in this guide, they will be promoting standards that benefit all Delphi developers by using a uniform style that is easy to read. Efforts to enforce these standards will increase the value of a developer's source code, particularly during maintenance and debugging cycles.”
This document does not refer to or explains the language syntax and grammar, as it is only focused on defining code writing style in places where the language gives you a choice, by allowing many different options in terms of whitespace and formatting.

None of these guidelines is set in stone and we expect them to evolve over time along with the language.