What Hans Passant is trying to understand is that the c operator creates a copy of the boundaries, works on it, and then discards it. I do not have enough information to verify this, but I feel that this is unlikely. The Delphi assignment operator works by reference, so implicit small copies do not actually happen that often.
However, the βcβ statements deliberately create a special kind of variation of hell. You could grab the field inside the borders, or you could grab the field from the containing method, or you could even grab the field from the previous closed c statement. Automatic refactoring cannot concern the with statement. Adding a field to the class the operator is working with can split the method .
Consider
with myLongNamedComponent.anotherLongNamedChild.pedanticRectangle do begin x:=1; y:=2; width:=33; height:=44; end;
Actually, itβs better written as
var bounds := new Rectangle(0,0,0,0); bounds.x := 1; bounds.y := 2; bounds.width := 33; bounds.height := 44; myLongNamedComponent.anotherLongNamedChild.pedanticRectangle := bounds;
TL: DR; the c operator is no longer considered good coding practice.
source share