a while ago we implemented a very useful feature called with matching. With matching is like with, but it does an <> nil check, and jumps over the whole block if it’s nil. This makes it possible to replace this:

if lMyObj is MyType thenbeginvar lMyTypeRef := lMyObj as MyType; lMyTypeRef.Prop1:=..lMyTypeRef.Prop2:=..lMyTypeRef.Prop3:=..lMyTypeRef.Prop4:=..lMyTypeRef.Method1() lMyTypeRef.Method2()...end;
with:
with matching lMyTypeRef := MyType(lMyObj)dobegin lMyTypeRef.Prop1:=..lMyTypeRef.Prop2:=..lMyTypeRef.Prop3:=..lMyTypeRef.Prop4:=..lMyTypeRef.Method1() lMyTypeRef.Method2()...end;
The matching keyword was originally introduced to allow a for each loop only process items that match a specific type like:
for each matching el:stringin myarraylist dobegin MessageBox.Show(el);...end;