Re: [fpc-pascal] Error: Argument cannot be assigned to

2023-06-04 Thread Michael Van Canneyt via fpc-pascal
On Sun, 4 Jun 2023, Juha Manninen via fpc-pascal wrote: On Sunday, June 4, 2023, Mattias Gaertner via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: Correct. Property RecInstance is read only. No, I can define it as : property RecInstance: TMyRec read fRecInstance write fRecIns

Re: [fpc-pascal] Error: Argument cannot be assigned to

2023-06-04 Thread Sven Barth via fpc-pascal
Martin Frb via fpc-pascal schrieb am So., 4. Juni 2023, 18:10: > On 04/06/2023 17:49, Martin via fpc-pascal wrote: > > On 04/06/2023 15:04, Juha Manninen via fpc-pascal wrote: > >> Why the following code fails to compile? > >> MyObj.RecInstance.ii := 123; > > Technically you can modify the member

Re: [fpc-pascal] Function to create a record ?

2023-06-04 Thread Steve Litt via fpc-pascal
Travis Siegel via fpc-pascal said on Sun, 4 Jun 2023 19:38:44 + > >On 6/4/2023 1:37 PM, Steve Litt via fpc-pascal wrote: >> Henry Vermaak via fpc-pascal said on Fri, 2 Jun 2023 09:38:17 +0100 >> >>> On Fri, 2 Jun 2023 at 01:36, Steve Litt via fpc-pascal >>> wrote: fillchar(j

Re: [fpc-pascal] Choice of exceptions to use?

2023-06-04 Thread Bart via fpc-pascal
On Sun, Jun 4, 2023 at 11:58 AM Graeme Geldenhuys via fpc-pascal wrote: > Initially I was leaning towards the Range exception, but now I'm > thinking that maybe the Argument exception is more appropriate > (based on the descriptions seen in the linked docs). I would go for range exception, since

Re: [fpc-pascal] Error: Argument cannot be assigned to

2023-06-04 Thread Juha Manninen via fpc-pascal
OK, I understand mostly. Thanks. Juha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Function to create a record ?

2023-06-04 Thread Travis Siegel via fpc-pascal
Depending on the compiler *not* to overwrite local variables is most certainly the wrong way to go with this.  You really should create either a global record/object, or use functions to pass around the information you need.  Expecting the operating system to keep local variables after the area

Re: [fpc-pascal] Error: Argument cannot be assigned to

2023-06-04 Thread Martin Frb via fpc-pascal
On 04/06/2023 17:49, Martin via fpc-pascal wrote: On 04/06/2023 15:04, Juha Manninen via fpc-pascal wrote: Why the following code fails to compile? MyObj.RecInstance.ii := 123; Technically you can modify the members of the temp record (just to have the work thrown away afterwards). So I guess

Re: [fpc-pascal] Error: Argument cannot be assigned to

2023-06-04 Thread Martin Frb via fpc-pascal
On 04/06/2023 15:04, Juha Manninen via fpc-pascal wrote: Why the following code fails to compile?   TMyRec = record ... property     RecInstance: TMyRec read fRecInstance;// write fRecInstance; ... MyObj.RecInstance.ii := 123; Access through property seems to be the problem. Accessing fRecI

Re: [fpc-pascal] Error: Argument cannot be assigned to

2023-06-04 Thread Martin via fpc-pascal
On 04/06/2023 15:04, Juha Manninen via fpc-pascal wrote: Why the following code fails to compile?   TMyRec = record ... property     RecInstance: TMyRec read fRecInstance;// write fRecInstance; ... MyObj.RecInstance.ii := 123; Access through property seems to be the problem. Accessing fRecI

Re: [fpc-pascal] Error: Argument cannot be assigned to

2023-06-04 Thread Juha Manninen via fpc-pascal
On Sunday, June 4, 2023, Mattias Gaertner via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > > Correct. Property RecInstance is read only. > No, I can define it as : property RecInstance: TMyRec read fRecInstance write fRecInstance; and still get the same error. Juha

Re: [fpc-pascal] Error: Argument cannot be assigned to

2023-06-04 Thread Mattias Gaertner via fpc-pascal
On Sun, 4 Jun 2023 16:04:48 +0300 Juha Manninen via fpc-pascal wrote: > Why the following code fails to compile? > > type > TMyRec = record > ss: String; > ii: Integer; > end; > TMyClass = class > private > fName: String; > fRecInstance: TMyRec; > property > RecInst

Re: [fpc-pascal] Function to create a record ?

2023-06-04 Thread Steve Litt via fpc-pascal
Ralf Quint via fpc-pascal said on Thu, 1 Jun 2023 17:43:58 -0700 >On 6/1/2023 5:36 PM, Steve Litt via fpc-pascal wrote: >> >> What is the best way for me to construct newperson() so that every >> time called it would return a new variable? >W.T.F.? > >Sorry, but for how long are you programmin

Re: [fpc-pascal] Function to create a record ?

2023-06-04 Thread Steve Litt via fpc-pascal
Henry Vermaak via fpc-pascal said on Fri, 2 Jun 2023 09:38:17 +0100 >On Fri, 2 Jun 2023 at 01:36, Steve Litt via fpc-pascal > wrote: >> fillchar(junkvar, junkvar_size, 'b'); >> person := modperson(person, 'Martin'); >> person := modperson(person2, 'Maria'); > >Maybe a typ

Re: [fpc-pascal] Error: Argument cannot be assigned to

2023-06-04 Thread Juha Manninen via fpc-pascal
Formatting was a little weird. This is what I meant, but the error remains : type TMyRec = record ss: String; ii: Integer; end; TMyClass = class private fName: String; fRecInstance: TMyRec; public property RecInstance: TMyRec read fRecInstance;// write fRecInstance;

Re: [fpc-pascal] Error: Argument cannot be assigned to

2023-06-04 Thread Juha Manninen via fpc-pascal
Compiler version is FPC 3.2.2 on Linux. Juha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Error: Argument cannot be assigned to

2023-06-04 Thread Juha Manninen via fpc-pascal
Why the following code fails to compile? type TMyRec = record ss: String; ii: Integer; end; TMyClass = class private fName: String; fRecInstance: TMyRec; property RecInstance: TMyRec read fRecInstance;// write fRecInstance; end; var MyObj : TMyClass; begin MyObj

[fpc-pascal] Choice of exceptions to use?

2023-06-04 Thread Graeme Geldenhuys via fpc-pascal
Hi, I'm working on code where the function take a (x, y) set of coordinates. If the coordinates are out of range/bounds, I want to raise an exception with a message explaining the reason and limits. I definitely don't want to "silently do nothing". Looking at these set of built-in exceptions: h