[fpc-pascal] with statement using mulltiple objects

Marco van de Voort marcov at stack.nl
Sun Sep 14 14:30:01 CEST 2014


In our previous episode, J?rgen Hestermann said:
>  > ---------------------------------------------------------
>  > d:=TreeRoot.SubDirs[Low(TreeRoot.SubDirs)]; // local var d
>  > d^.DirLogged             := true;
>  > d^.DirHatFocus           := false;
>  > d^.SubDirsExpanded       := true;
>  > [...] ---------------------------------------------------------
> 
> 
> Long-winded and still not the same clarity as in the with statement.

But the important part is that it forces each property/field to be a member
of T, or get a compiler error.

WITH doesn't, and you risk that if your class or one of its ancestor has
such property, and your error goes unnoticed.
 



More information about the fpc-pascal mailing list