Uncategorized

Lightweight Multicast Events

A multicast event is an event that can have multiple listeners (or event handlers). Some languages (such as .NET languages) have built-in support for multicast events. This article shows an implementation for Delphi. This implementation is very lightweight. In fact, it takes no more resources than a regular Delphi event if there is just a… Continue reading Lightweight Multicast Events

Patterns · Tips & Tricks

The Curiously Recurring Generic Pattern

This curious little pattern can be helpful for certain problems that involve generics. We’ll look at what it is, and at a couple of use cases for it. What is it? The Curiously Recurring Generic Pattern (CRGP) is a pattern where a class TFoo derives from a generic class, using the class TFoo itself as… Continue reading The Curiously Recurring Generic Pattern

Patterns · Tips & Tricks · Uncategorized

Mapping Delphi Types to Indices at Compile Time

Say what now? In this post I will show you how you can use generics and class variables to generate unique incrementing indices for any Delphi type. For example, the Integer type could map to index 1 and the TStream type to index 2 etc. The values of these indices will be determined (partially) at… Continue reading Mapping Delphi Types to Indices at Compile Time

Foundation · Uncategorized

Expand your Collections collection – Part 1: a generic set

Welcome to this first post in a series about custom (generic) collections in Delphi. These are part of our Grijjy Foundation library of classes and utilities that are used throughout our code base. Other Grijjy Repositories often depend on this library. Introducing TgoSet Have you ever doubted between using a TList<T> or TDictionary<T> to store… Continue reading Expand your Collections collection – Part 1: a generic set