Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-15 Thread Marco van de Voort
On Wed, Nov 11, 2015 at 07:53:33PM +0100, Marco van de Voort wrote: > > I replaced many endangered with-blocks in the LCL. > > ToDo: check the rest of the Lazarus sources. > > Ok, I plan finalizing and committing the trect stuff in the coming week. The first batch is committed. Tpoint* is

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-13 Thread Marco van de Voort
On Wed, Nov 11, 2015 at 10:37:48PM +0100, Bart wrote: > On 11/11/15, Marco van de Voort wrote: > > > Ok, I plan finalizing and committing the trect stuff in the coming week. > > Should these be merged to 1.4 fixes branch? If you want to run 1.4 with trunk yes. It won't be in

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-11 Thread Mattias Gaertner
On Sat, 7 Nov 2015 00:21:09 +0100 Marco van de Voort wrote: >[...] > Anyway, I hunted down one case by raise tobject.create, and running in the > debugger, and I committed a fix. The Win32 lazarus now seems to function > normally at first glance. I replaced many endangered

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-11 Thread Anthony Walter
My solution is to define my own TRectI type which can implicitly convert between TRectI <-> TRect. Also I use a TRectF which does the same thing, but with floats as the dimenions ... MyRectInt := TRectI(MyRectFloat); ... There is also TPointI and TPointF ... { TRectI } TRectI = record

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-11 Thread Marco van de Voort
On Wed, Nov 11, 2015 at 04:39:55PM +0100, Mattias Gaertner wrote: > >[...] > > Anyway, I hunted down one case by raise tobject.create, and running in the > > debugger, and I committed a fix. The Win32 lazarus now seems to function > > normally at first glance. > > I replaced many endangered

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-11 Thread Bart
On 11/11/15, Marco van de Voort wrote: > Ok, I plan finalizing and committing the trect stuff in the coming week. Should these be merged to 1.4 fixes branch? Bart -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-11 Thread Juha Manninen
On Wednesday, November 11, 2015, Bart wrote: > > Should these be merged to 1.4 fixes branch? > No, Lazarus 1.4 dot versions are released with FPC 2.6.4. The TRect changes will happen in FPC trunk only. Juha -- ___ Lazarus mailing

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-10 Thread Sven Barth
Am 10.11.2015 09:40 schrieb "Jürgen Hestermann" : > > Am 2015-11-09 um 14:26 schrieb Sven Barth: >> >> >> > The docs already note that the compiler uses a temporary register >> > for 'With'. >> > http://www.freepascal.org/docs-html/ref/refsu58.html#x155-16500013.2.8 >> >

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-10 Thread Jürgen Hestermann
Am 2015-11-09 um 14:26 schrieb Sven Barth: > The docs already note that the compiler uses a temporary register > for 'With'. > http://www.freepascal.org/docs-html/ref/refsu58.html#x155-16500013.2.8 > Of course if there is no register left the compiler uses the stack. Please note that this is

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-10 Thread Mattias Gaertner
On Tue, 10 Nov 2015 12:26:56 +0100 Jürgen Hestermann wrote: >[...] > Does that mean, that local variables and with statements are treated > completely identically? A local var can be changed. Without optimization the compiler puts the local var on the stack. With

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-10 Thread Jürgen Hestermann
Am 2015-11-10 um 11:32 schrieb Sven Barth: The user doesn't need to know the detail that the value is kept in a temporary register, because that statement by itself is utterly useless for the user, as on load/store architectures like ARM you /always/ have values in registers if they are

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-10 Thread Sven Barth
Am 10.11.2015 12:27 schrieb "Jürgen Hestermann" : > > Am 2015-11-10 um 11:32 schrieb Sven Barth: >> >> The user doesn't need to know the detail that the value is kept in a temporary register, because that statement by itself is utterly useless for the user, as on

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-10 Thread Sven Barth
Am 10.11.2015 14:37 schrieb "Sven Barth" : > > Am 10.11.2015 12:27 schrieb "Jürgen Hestermann" : > > > > Am 2015-11-10 um 11:32 schrieb Sven Barth: > >> > >> The user doesn't need to know the detail that the value is kept in a temporary

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-09 Thread Sven Barth
Am 09.11.2015 13:11 schrieb "Mattias Gaertner" : > > On Mon, 9 Nov 2015 10:48:02 + > Lukasz Sokol wrote: > > >[...] > > Thanks, I believe, this should be added into the docs somewhere ;) if it's not already there. > > The docs already note that

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-09 Thread Lukasz Sokol
On 07/11/15 11:01, Mattias Gaertner wrote: > On Sat, 7 Nov 2015 11:39:44 +0100 > Jürgen Hestermann wrote: > [...] >> - >> with PathArray[High(PathArray)]^ do >> fillchar(StatisticOfFiles,sizeof(StatisticOfFiles),0); >>

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-09 Thread Lukasz Sokol
On 09/11/15 10:19, Mattias Gaertner wrote: > The above three are not the same. > > The second version executes the With-Expression multiple times, so > unless the compiler optimizes a lot it will create more code and will be > slower. > > The first and third versions have the same amount of

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-09 Thread Mattias Gaertner
On Mon, 9 Nov 2015 09:38:27 + Lukasz Sokol wrote: >[...] On 07/11/15 11:01, Mattias Gaertner wrote: > > On Sat, 7 Nov 2015 11:39:44 +0100 > > Jürgen Hestermann wrote: > > > [...] > >> - > >> with

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-09 Thread Mattias Gaertner
On Mon, 9 Nov 2015 10:48:02 + Lukasz Sokol wrote: >[...] > Thanks, I believe, this should be added into the docs somewhere ;) if it's > not already there. The docs already note that the compiler uses a temporary register for 'With'.

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-07 Thread Florian Klaempfl
Am 07.11.2015 um 06:40 schrieb Alexander Klenin: > On Sat, Nov 7, 2015 at 5:58 AM, Florian Klaempfl > wrote: >> Am 06.11.2015 um 20:22 schrieb Luca Olivetti: >>> El 06/11/15 a les 18:10, Martin Schreiber ha escrit: >>> You are joking, no? It has been discussed on

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-07 Thread Florian Klaempfl
Am 07.11.2015 um 06:42 schrieb Ondrej Pokorny: > > Do not forget that you can overload operators! In particular you can > overload the comparison operator to return a record, so your > "with a=somerecord do" can already be a valid pascal code now: > > *type** > ** TMyRec = record** > **I:

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-07 Thread Jürgen Hestermann
Am 2015-11-06 um 18:26 schrieb Ondrej Pokorny: > So yes, let's not use with :) > ... There is no problem with long variable names at all. There are CodeTools :) CodeTools do not help you *read* the code. I prefer to have this: - with PathArray[High(PathArray)]^ do

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-07 Thread Mattias Gaertner
On Sat, 7 Nov 2015 11:39:44 +0100 Jürgen Hestermann wrote: >[...] > CodeTools do not help you *read* the code. It can help you writing the code more readable and helps to read (i.e. understand) the code by hints and find declaration. >[...] >

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-07 Thread Michael Van Canneyt
On Sat, 7 Nov 2015, Alexander Klenin wrote: On Sat, Nov 7, 2015 at 5:58 AM, Florian Klaempfl wrote: Am 06.11.2015 um 20:22 schrieb Luca Olivetti: El 06/11/15 a les 18:10, Martin Schreiber ha escrit: You are joking, no? It has been discussed on fpc-pascal/fpc-devel

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Marco van de Voort
On Fri, Nov 06, 2015 at 07:25:01PM +0100, Mattias Gaertner wrote: > > width and height of the trect are assigned instead of the component's ? > > Thanks for the hint. > > Does Delphi alter some other records too, e.g. TPoint and TSize? > > Hint: > Cody has a tool 'Explode a "With" block': >

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Sven Barth
Am 06.11.2015 17:59 schrieb "Marco van de Voort" : > > On Fri, Nov 06, 2015 at 05:42:39PM +0100, Michael Van Canneyt wrote: > > > by Delphi compatibility... > > > > Ehm. How can "with" ever be safe ? > > Btw the case that I fixed was like this > > procedure TSomeForm.Getwind... >

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Ondrej Pokorny
On 06.11.2015 22:45, Mark Morgan Lloyd wrote: Luca Olivetti wrote: with a=somerecord, b=someotherrecord do begin a.x:=b.x; end; Just because something is 20+ years old doesn't necessarily make it bad. That syntax looks OK to me (i.e. make a and b look like consts) but I also find

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Alexander Klenin
On Sat, Nov 7, 2015 at 5:58 AM, Florian Klaempfl wrote: > Am 06.11.2015 um 20:22 schrieb Luca Olivetti: >> El 06/11/15 a les 18:10, Martin Schreiber ha escrit: >> >>> You are joking, no? It has been discussed on fpc-pascal/fpc-devel several >>> times. An IIRC Italian

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Luca Olivetti
El 06/11/15 a les 18:10, Martin Schreiber ha escrit: You are joking, no? It has been discussed on fpc-pascal/fpc-devel several times. An IIRC Italian community member then usually shows a syntax description of a safe "with" statement from a maybe more than 20 year old pascal dialect. I don't

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Dmitry Boyarintsev
On Fri, Nov 6, 2015 at 1:25 PM, Mattias Gaertner wrote: > > Does Delphi alter some other records too, e.g. TPoint and TSize? > > It does http://docwiki.embarcadero.com/Libraries/Seattle/en/System.Types.TPoint

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Martin Schreiber
On Friday 06 November 2015 18:19:14 Michael Van Canneyt wrote: > > But presumably you mean some construct as > > With QMyVeryLongQueyObjectName as Q do >try > // Do things with Q >finally > Q.Close; >end; > > ? > Correct. There have been some more notations suggested. Martin

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Graeme Geldenhuys
On 2015-11-06 17:19, Michael Van Canneyt wrote: > With QMyVeryLongQueyObjectName as Q do >try > // Do things with Q >finally > Q.Close; >end; var Q: TQuery absolute QMyVeryLongQueyObjectName; begin with Q do try // Do things with Q finally Q.Close;

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Michael Van Canneyt
On Fri, 6 Nov 2015, Martin Schreiber wrote: On Friday 06 November 2015 17:42:39 Michael Van Canneyt wrote: On Fri, 6 Nov 2015, Martin Schreiber wrote: On Friday 06 November 2015 17:20:24 Ondrej Pokorny wrote: Nevertheless I am of the opinion that WITH is evil and should be removed from the

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Ondrej Pokorny
On 06.11.2015 17:42, Michael Van Canneyt wrote: Ehm. How can "with" ever be safe ? You can make sure that if some property is ADDED into the with scope, it doesn't break anything by explicitely using Self (or the unit name or whatever): procedure TForm1.DoMySize; begin //... with

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Michael Van Canneyt
On Fri, 6 Nov 2015, Martin Schreiber wrote: On Friday 06 November 2015 18:33:54 Graeme Geldenhuys wrote: On 2015-11-06 17:19, Michael Van Canneyt wrote: With QMyVeryLongQueyObjectName as Q do try // Do things with Q finally Q.Close; end; var Q: TQuery absolute

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Mattias Gaertner
On Fri, 6 Nov 2015 16:45:07 +0100 Marco van de Voort wrote: >[...] > I yesterday tried to implement some of the TRect helper methods in 3.1.1 >[...] > I haven't investigated deeper yet, but I suspect the heavy use of WITH in > interfaces etc is the cause. (if you assign width

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Bart
@marcov: your patch for this issue in r50234 seems to have mangled some utf8-codepoints in a comment about Bézier curves (line 2739 and 2749)? Bart -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Martin Schreiber
On Friday 06 November 2015 18:33:54 Graeme Geldenhuys wrote: > On 2015-11-06 17:19, Michael Van Canneyt wrote: > > With QMyVeryLongQueyObjectName as Q do > >try > > // Do things with Q > >finally > > Q.Close; > >end; > > var > Q: TQuery absolute QMyVeryLongQueyObjectName; >

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Florian Klaempfl
Am 06.11.2015 um 20:22 schrieb Luca Olivetti: > El 06/11/15 a les 18:10, Martin Schreiber ha escrit: > >> You are joking, no? It has been discussed on fpc-pascal/fpc-devel several >> times. An IIRC Italian community member then usually shows a syntax >> description of a safe "with" statement from

[Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Marco van de Voort
FYI: I yesterday tried to implement some of the TRect helper methods in 3.1.1 and property and Lazarus(/win32) refused to start due to WMSIZE loops. I haven't investigated deeper yet, but I suspect the heavy use of WITH in interfaces etc is the cause. (if you assign width and height of a

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Dmitry Boyarintsev
On Fri, Nov 6, 2015 at 10:45 AM, Marco van de Voort wrote: > I haven't investigated deeper yet, but I suspect the heavy use of WITH in > interfaces etc is the cause. (if you assign width and height of a > component in a component method in a WITH with a TRECT as argument, then

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Ondrej Pokorny
On 06.11.2015 17:08, Dmitry Boyarintsev wrote: This is odd. How adding the method to TRect didn't break much for Delphi? It did break a lot of code for Delphi. I'd think that Delphi /3d party components code also uses a lot of WITHs with TRects. Yes, it did break a lot of code in 3rd

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Marco van de Voort
On Fri, Nov 06, 2015 at 11:08:29AM -0500, Dmitry Boyarintsev wrote: > > I haven't investigated deeper yet, but I suspect the heavy use of WITH in > > interfaces etc is the cause. (if you assign width and height of a > > component in a component method in a WITH with a TRECT as argument, then > >

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Martin Schreiber
On Friday 06 November 2015 17:20:24 Ondrej Pokorny wrote: > > Nevertheless I am of the opinion that WITH is evil and should be removed > from the IDE/LCL code (unless only identifiers from within the with > scope are used; but even then they could be removed...). Or implement a safe "with" in

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Graeme Geldenhuys
On 2015-11-06 16:20, Ondrej Pokorny wrote: > Nevertheless I am of the opinion that WITH is evil +1 Especially if you mix more than one scope/variable in the with block. Regards, - Graeme - -- ___ Lazarus mailing list

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Michael Van Canneyt
On Fri, 6 Nov 2015, Martin Schreiber wrote: On Friday 06 November 2015 17:20:24 Ondrej Pokorny wrote: Nevertheless I am of the opinion that WITH is evil and should be removed from the IDE/LCL code (unless only identifiers from within the with scope are used; but even then they could be

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Marco van de Voort
On Fri, Nov 06, 2015 at 05:42:39PM +0100, Michael Van Canneyt wrote: > > by Delphi compatibility... > > Ehm. How can "with" ever be safe ? Btw the case that I fixed was like this procedure TSomeForm.Getwind... procedure setwidthheight(const r : TRect); inline; begin with R do begin

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Flávio Etrusco
On Fri, Nov 6, 2015 at 1:42 PM, Michael Van Canneyt wrote: > > > On Fri, 6 Nov 2015, Martin Schreiber wrote: > >> On Friday 06 November 2015 17:20:24 Ondrej Pokorny wrote: >>> >>> >>> Nevertheless I am of the opinion that WITH is evil and should be removed >>> from the

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Graeme Geldenhuys
On 2015-11-06 16:42, Michael Van Canneyt wrote: > I use it abundantly. If I have QMYQueryObjectWithAVeryLongName then being > able to write Can't you simply use an "absolute" variable, or alias variable with a shorter name - instead of WITH all together. I hate WITH, but do use it on occasion -

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Graeme Geldenhuys
On 2015-11-06 16:42, Michael Van Canneyt wrote: > Ehm. How can "with" ever be safe ? I forgot to add in my previous message... I also can't see how WITH can ever be made safe. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Martin Schreiber
On Friday 06 November 2015 17:42:39 Michael Van Canneyt wrote: > On Fri, 6 Nov 2015, Martin Schreiber wrote: > > On Friday 06 November 2015 17:20:24 Ondrej Pokorny wrote: > >> Nevertheless I am of the opinion that WITH is evil and should be removed > >> from the IDE/LCL code (unless only

Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-06 Thread Mark Morgan Lloyd
Luca Olivetti wrote: El 06/11/15 a les 18:10, Martin Schreiber ha escrit: You are joking, no? It has been discussed on fpc-pascal/fpc-devel several times. An IIRC Italian community member then usually shows a syntax description of a safe "with" statement from a maybe more than 20 year old