Record helpers can do wonders for code clarity.
// Never mind the silly example
TResult = (CompletedOK, PartiallyPerformed, NothingHappened, HorriblyWrong);
Result := PartiallyPerformed;
How do we determine failure vs success?
if not DoSomething = CompletedOK then …?
What about Partially performed and nothing happened?
Enter the helper:
TResultHelper = record helper for TResult
function TResultHelper.Failed: Boolean;
Result := (Self = HorriblyWrong);
Result := not Failed;
Now we can write
if DoSomething.Failed then …
Note that you also can enter the murky waters of obfuscation through helpers, but at least the murkiness will be consistent 😛