[fpc-pascal] with statement using mulltiple objects

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Sep 14 12:08:12 CEST 2014


On Sun, 14 Sep 2014 11:58:22 +0200
J├╝rgen Hestermann <juergen.hestermann at gmx.de> wrote:

> Am 2014-09-13 22:31, schrieb Marius:
>  > Mattias Gaertner wrote:
>  > All seasoned programmers know that and try to avoid the with statement.

The quote is from Marius, not from me.


> Realy? I love it. Consider these two varianst of code from one of my programs:
> 
> ---------------------------------------------------------
> with TreeRoot.SubDirs[Low(TreeRoot.SubDirs)]^ do
>     begin
>     DirLogged             := true;
>     DirHatFocus           := false;
>     SubDirsExpanded       := true;
>[...]
> ---------------------------------------------------------

and

---------------------------------------------------------
d:=TreeRoot.SubDirs[Low(TreeRoot.SubDirs)]; // local var d
d^.DirLogged             := true;
d^.DirHatFocus           := false;
d^.SubDirsExpanded       := true;
[...] ---------------------------------------------------------


Mattias



More information about the fpc-pascal mailing list