The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,994 other followers

Delphi analog to C# ?? null-coalescing operator and Light Table like debugger evaluation

Posted by jpluimers on 2017/09/05

Interesting stuff:


In more detail:

Source: 2016-10-15 – Zenryokuwawa


  TObjectHelper = class helper for TObject
    class function &&op_LogicalOr(A, B: T): T; static;

class function TObjectHelper.&&op_LogicalOr(A, B: T): T;
  if A <> nil then
    Result := A
    Result := B;

procedure Test;
  sl1, sl2, sl3: TStringList;
  sl1 := nil;
  sl2 := TStringList.Create;
  sl3 := sl1 or sl2; // -> sl3 = sl2


3 Responses to “Delphi analog to C# ?? null-coalescing operator and Light Table like debugger evaluation”

  1. rvelthuis said

    The TObjectHelper thing is amazing. It also works on classes, and I already managed to do addition, or to write a helper that gives TStrings an in operator. It is simply a cool find.

    • jpluimers said

      It’s indeed one of the language additions I like a lot.

      • sglienke said

        It’s a feature by accident – I hope they will add it as an official feature. Some operators are harmless to introduce for classes also on non ARC. Also introducing operator overloads per helper is a good thing and should be supported officially rather than having to use some compiler glitch.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: