Re: [fpc-pascal] Open array in object constructor gives error

2023-01-04 Thread Sven Barth via fpc-pascal
Hairy Pixels schrieb am Mi., 4. Jan. 2023, 14:45: > > > > On Jan 4, 2023, at 8:23 PM, Sven Barth > wrote: > > > > You said in the other mail "there's a global stack", so just return > memory from that stack. > > Well the stack is just a list that holds pointers to the classes now but I > guess y

Re: [fpc-pascal] Open array in object constructor gives error

2023-01-04 Thread Hairy Pixels via fpc-pascal
> On Jan 4, 2023, at 8:23 PM, Sven Barth wrote: > > You said in the other mail "there's a global stack", so just return memory > from that stack. Well the stack is just a list that holds pointers to the classes now but I guess you can modify that so it turns a pointer to an address in a blo

Re: [fpc-pascal] Open array in object constructor gives error

2023-01-04 Thread Sven Barth via fpc-pascal
Hairy Pixels schrieb am Mi., 4. Jan. 2023, 13:06: > > > > On Jan 4, 2023, at 2:01 PM, Sven Barth > wrote: > > > > For something like that you are better of to use Object Pascal classes > and override their NewInstance and FreeInstance methods. > > > > What do you mean exactly? You still need to

Re: [fpc-pascal] Open array in object constructor gives error

2023-01-04 Thread Hairy Pixels via fpc-pascal
> On Jan 4, 2023, at 2:01 PM, Sven Barth wrote: > > For something like that you are better of to use Object Pascal classes and > override their NewInstance and FreeInstance methods. > What do you mean exactly? You still need to allocate some memory for them right so what do you gain? Reg

Re: [fpc-pascal] Open array in object constructor gives error

2023-01-03 Thread Sven Barth via fpc-pascal
Hairy Pixels via fpc-pascal schrieb am Mi., 4. Jan. 2023, 02:40: > > > > On Jan 3, 2023, at 8:39 PM, Marc Weustink via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > On what instance/variable/piece of memory would your code > "TMyObject.Create(['1', '2', '3'])" then operate ? > >

Re: [fpc-pascal] Open array in object constructor gives error

2023-01-03 Thread Hairy Pixels via fpc-pascal
> On Jan 3, 2023, at 8:39 PM, Marc Weustink via fpc-pascal > wrote: > > On what instance/variable/piece of memory would your code > "TMyObject.Create(['1', '2', '3'])" then operate ? There’s a global stack which is opened and they are stored there during construction. Regards, Ryan Joseph

Re: [fpc-pascal] Open array in object constructor gives error

2023-01-03 Thread Marc Weustink via fpc-pascal
On 3-1-2023 14:07, Hairy Pixels via fpc-pascal wrote: On Jan 3, 2023, at 3:12 PM, Sven Barth wrote: But then you don't use the type name either. You simply do "o.Create(...)". O I get it now. I didn’t realize you couldn’t create on the type. That breaks my entire design then. It wo

Re: [fpc-pascal] Open array in object constructor gives error

2023-01-03 Thread Sven Barth via fpc-pascal
Hairy Pixels schrieb am Di., 3. Jan. 2023, 14:07: > > > > On Jan 3, 2023, at 3:12 PM, Sven Barth > wrote: > > > > But then you don't use the type name either. You simply do > "o.Create(...)". > > > > O I get it now. I didn’t realize you couldn’t create on the type. That > breaks my entire de

Re: [fpc-pascal] Open array in object constructor gives error

2023-01-03 Thread Hairy Pixels via fpc-pascal
> On Jan 3, 2023, at 3:12 PM, Sven Barth wrote: > > But then you don't use the type name either. You simply do "o.Create(...)". > O I get it now. I didn’t realize you couldn’t create on the type. That breaks my entire design then. It would be great to have a modern object that behaved m

Re: [fpc-pascal] Open array in object constructor gives error

2023-01-03 Thread Sven Barth via fpc-pascal
Hairy Pixels schrieb am Di., 3. Jan. 2023, 08:04: > > > > On Jan 3, 2023, at 1:36 PM, Sven Barth > wrote: > > > > Objects are not classes, they don't know the Object Pascal style syntax > for creating them, instead you need to use the syntax for objects from TP > times: > > But why do you need t

Re: [fpc-pascal] Open array in object constructor gives error

2023-01-02 Thread Hairy Pixels via fpc-pascal
> On Jan 3, 2023, at 1:36 PM, Sven Barth wrote: > > Objects are not classes, they don't know the Object Pascal style syntax for > creating them, instead you need to use the syntax for objects from TP times: But why do you need to use New if you just want a stack allocated object? The constr

Re: [fpc-pascal] Open array in object constructor gives error

2023-01-02 Thread Sven Barth via fpc-pascal
Am 31.12.2022 um 04:35 schrieb Hairy Pixels via fpc-pascal: Why is using the open array parameter illegal using the Object type? {$mode objfpc} program test; type TMyObject = object constructor Create(text: array of String); end; constructor TMyObject.Crea

Re: [fpc-pascal] Open array in object constructor gives error

2023-01-01 Thread Hairy Pixels via fpc-pascal
> On Dec 31, 2022, at 3:43 PM, Mattias Gaertner via fpc-pascal > wrote: > > Not supported. Has nothing to do with the parameter list. That’s disappointing. :( More reason we need an “advanced objects” mode switch. Regards, Ryan Joseph ___ fpc-pasc

Re: [fpc-pascal] Open array in object constructor gives error

2022-12-31 Thread Mattias Gaertner via fpc-pascal
On Sat, 31 Dec 2022 10:35:52 +0700 Hairy Pixels via fpc-pascal wrote: > Why is using the open array parameter illegal using the Object type? > > > > {$mode objfpc} > > program test; > > type > TMyObject = object > constructor Create(text: array of String); > e

[fpc-pascal] Open array in object constructor gives error

2022-12-30 Thread Hairy Pixels via fpc-pascal
Why is using the open array parameter illegal using the Object type? {$mode objfpc} program test; type TMyObject = object constructor Create(text: array of String); end; constructor TMyObject.Create(text: array of String); begin end; begin TMyObject.Create([