Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Martin Schreiber
On Monday 15 September 2014 07:55:20 Sven Barth wrote: > > As you can see the expression p^ is only evaluated once in the TestWith > case while it's evaluated twice in the TestWithout one. So it's only > minimally faster in this example (one less memory access), but if you > use enough members of T

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Sven Barth
On 15.09.2014 03:06, Jim Leonard wrote: On 9/13/2014 2:02 PM, Sven Barth wrote: It has always worked in this manner. It's just for abbreviating typing, not for combining properties. (and then the with-variant with multiple elements is even more seldomly used than the single-element one...) In

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Sven Barth
On 14.09.2014 18:05, Philippe wrote: someone wrote about a better performance using "with". is that true? even with a simple pointer as in: with ptr^ do begin prop1 := ... prop2 := ... end; which should be faster then ptr^.prop1 := ... ptr^.prop1 := ... others wrote it is just usefull to

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Jim Leonard
On 9/13/2014 2:02 PM, Sven Barth wrote: It has always worked in this manner. It's just for abbreviating typing, not for combining properties. (and then the with-variant with multiple elements is even more seldomly used than the single-element one...) In the Turbo Pascal days, WITH allowed for s

Re: [fpc-pascal] Imagemagick: magickwand doesn't convert to TIFF 1 bit

2014-09-14 Thread José Mejuto
El 13/09/2014 17:34, Reinier Olislagers escribió: (Earlier posted on forum) See subject - I've posted this on stackoverflow http://stackoverflow.com/questions/25719495/magickwand-conversion-to-tiffccitt-group-4-compression-gives-uncompressed-image Link to example program + demo image is include

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Luca Olivetti
El 14/09/14 12:22, Jürgen Hestermann ha escrit: >> - >> d:=TreeRoot.SubDirs[Low(TreeRoot.SubDirs)]; // local var d >> d^.DirLogged := true; >> d^.DirHatFocus := false; >> d^.SubDirsExpanded := true; >> [...] --

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Philippe
someone wrote about a better performance using "with". is that true? even with a simple pointer as in: with ptr^ do begin prop1 := ... prop2 := ... end; which should be faster then ptr^.prop1 := ... ptr^.prop1 := ... others wrote it is just usefull to save writing time ... Em

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Luca Olivetti
El 14/09/14 17:20, Marco van de Voort ha escrit: > In our previous episode, Martin Schreiber said: >>> basically stopped using it. >> >> Why does Free Pascal not invent a safe "with" similar as the "with" of >> MSElang? > > The primary question is of course if there is a need for a new construct

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Philippe
main problem seems to be using property whose name is common within 2 objects of the same "with" (or code within several "with") could it be controlled by a compiler option? in that case compiler may return a hint or warning or even an error depending of the choosen configuration ... does

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Marco van de Voort
In our previous episode, Martin Schreiber said: > > basically stopped using it. > > Why does Free Pascal not invent a safe "with" similar as the "with" of > MSElang? The primary question is of course if there is a need for a new construct at all. I don't know MSELang, but many new languages try

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Martin Schreiber
On Sunday 14 September 2014 16:34:06 Marco van de Voort wrote: > > In the past I had the same opinion about with (WITHs evilness is > exaggerated) as many others, but once I bumped my head a few times while > using OO frameworks that were either not of my design or very large, I > basically stopped

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Bernd Oppolzer
The reason why I made these comparisons to PL/1: PL/1 was designed in the mid 60s, and Wirth of course knew about PL/1, because he was at IBM at the time, and of course he was aware of the problems and pitfalls of PL/1. By including the WITH statement into PASCAL, he probably wanted to give the

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Vojtěch Čihák
Hi,   once I came to troubles with "with":   procedure TForm1.StringGrid1SelectEditor(Sender: TObject; aCol, aRow: Integer; var Editor: TWinControl); begin   with StringGrid1 do     begin       ...       Editor:= ...;       ...     end; end;  because Editor is also public property of TStringGrid

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Bernd Oppolzer
Am 14.09.2014 15:39, schrieb Ched: Hello All, My two cents. The with statement is crystal clear for me. If newbies prefer to use different manners to code the things, that are free to do it. Using some kind of intermediate variable ? That's make to code difficult to understand, need do open

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Marco van de Voort
In our previous episode, Ched said: > So, they with statement has at least one aficionados: me. Was the with > statement present if the first > versions designed by Wirth himself ? Yes, but the problems are mostly because of the scoping complexity that OO extensions like classes add. Specially b

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Mark Morgan Lloyd
Ched wrote: Hello All, My two cents. The with statement is crystal clear for me. If newbies prefer to use different manners to code the things, that are free to do it. Using some kind of intermediate variable ? That's make to code difficult to understand, need do open begin/end blocks in som

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Ched
Hello All, My two cents. The with statement is crystal clear for me. If newbies prefer to use different manners to code the things, that are free to do it. Using some kind of intermediate variable ? That's make to code difficult to understand, need do open begin/end blocks in some situations.

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Philippe
-1. !!! I like "with" ... even it may give trouble times to times!!! ... but I work alone on my programs ... as always ... nothing perfect! always should consider the conditions!! Em 14.09.2014 09:30, Michael Thompson escreveu: >> We have spend weeks (if not months) off hunting

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Michael Thompson
> We have spend weeks (if not months) off hunting down this kind of bugs. > And its this kind of bug what showed up frequently in teams of > programmers and that made us decide to ban the with statement as much > as possible. Sooner or later the with stament is going to bite you, I > just hope you

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Marco van de Voort
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; > >

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Marius
Jürgen Hestermann wrote: >Do you also prepent all function and variable names >with the unit name they come from? >Do you realy always write > >LazUTF8.UTF8Delete >instead of >UTF8Delete >? > >Nested WITH statements and the unit concept share the >same problem but still the benefits outweigh the d

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Marius
Jürgen Hestermann wrote: >Realy? I love it. Consider these two varianst of code from one of my >programs: This is a simpler example than the one with with the 4 levels deep (which can be quite a puzzle if there are multiple records containing the same fieldname(s)). And yes you may love them but

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Sven Barth
Am 14.09.2014 09:36 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > > On 2014-09-13 21:04, Mattias Gaertner wrote: > >> What is the rationale for such a statement, ie using multliple elements? > > Less typing. > > ...and increases grey hair growth (due to lots more trouble debugging

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Jürgen Hestermann
Am 2014-09-14 12:08, schrieb Mattias Gaertner: >> > All seasoned programmers know that and try to avoid the with statement. > The quote is from Marius, not from me. Correct. I deleted the wrong reference. ;-( >> Realy? I love it. Consider these two varianst of code from one of my programs: >>

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Mattias Gaertner
On Sun, 14 Sep 2014 11:58:22 +0200 Jürgen Hestermann 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

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Jürgen Hestermann
Am 2014-09-13 22:31, schrieb Marius: > Mattias Gaertner wrote: > All seasoned programmers know that and try to avoid the with statement. Realy? I love it. Consider these two varianst of code from one of my programs: - with TreeRoot.SubDirs

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Graeme Geldenhuys
On 2014-09-13 21:31, Marius wrote: > programmers know that and try to avoid the with statement. +1 Regards, - Graeme - ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Graeme Geldenhuys
On 2014-09-13 21:04, Mattias Gaertner wrote: >> What is the rationale for such a statement, ie using multliple elements? > Less typing. ...and increases grey hair growth (due to lots more trouble debugging). :-) Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free P