Delphi idioms – Creating and destroying an object

Patterns are mostly language independent. We could have written an equivalent of the Iterate method from the previous sections in most languages, even in old Turbo Pascal for DOS or in an assembler. The for..in construct, however, is specific to Delphi. We call such a low-level pattern an idiom.

Idioms are not that useful when we are thinking about or discussing the program design. The knowledge of a language's is, however, necessary for you to become fluent in a language. Idioms teach us about the best ways of performing common operations in a particular environment.

The most important Delphi idiom concerns how object creation and destruction should be handled in code. It is used whenever ...

Get Mastering Delphi Programming: A Complete Reference Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.