Re: [fpc-pascal] Procedural parameters

2024-12-16 Thread Michael Van Canneyt via fpc-pascal
On Sun, 15 Dec 2024, Sven Barth via fpc-pascal wrote: Which I paraphrased loosely as: "It's not because something is in the pascal standard, that FPC has it." As with any of the language dialect compatibility modes the point is that FPC can compile code in that dialect, but *not* that cod

Re: [fpc-pascal] Procedural parameters

2024-12-15 Thread Hairy Pixels via fpc-pascal
On Dec 15, 2024 at 11:19:40 PM, Sven Barth wrote: > It's not as if it is impossible to workaround this limitation: > > === code begin === > > program tpointerrec; > > {$mode objfpc} > {$modeswitch advancedrecords} > > type > generic TPointer = record > type > PT = ^T; > end; > > gene

Re: [fpc-pascal] Procedural parameters

2024-12-15 Thread Sven Barth via fpc-pascal
Michael Van Canneyt via fpc-pascal schrieb am So., 15. Dez. 2024, 18:25: > > > On Sun, 15 Dec 2024, Adriaan van Os via fpc-pascal wrote: > > > Michael Van Canneyt via fpc-pascal wrote: > >> > >> > >> On Sat, 14 Dec 2024, Adriaan van Os via fpc-pascal wrote: > >> > >> It's not because something is

Re: [fpc-pascal] Procedural parameters

2024-12-15 Thread Michael Van Canneyt via fpc-pascal
On Sun, 15 Dec 2024, Adriaan van Os via fpc-pascal wrote: Michael Van Canneyt via fpc-pascal wrote: On Sat, 14 Dec 2024, Adriaan van Os via fpc-pascal wrote: It's not because something is in the pascal standard, that FPC has it. It is. Appendix D6 of the Programmer's Reference says "T

Re: [fpc-pascal] Procedural parameters

2024-12-15 Thread Sven Barth via fpc-pascal
Am 15.12.2024 um 13:11 schrieb Hairy Pixels via fpc-pascal: On Dec 15, 2024 at 6:28:25 PM, Hairy Pixels wrote: Also noteworthy is ISO standard can accommodate generics which Borland’s design can not. Wait, I’m wrong on this, you can use generic proc types. The problem with generics are poin

Re: [fpc-pascal] Procedural parameters

2024-12-15 Thread Sven Barth via fpc-pascal
Am 15.12.2024 um 01:58 schrieb Hairy Pixels via fpc-pascal: Forcing function types and pointers to be type declaration only is now a limitation for generic procedures and should be reversed. No reason to be following what some Borland engineer was doing in the 80’s when it’s 2024. procedure D

Re: [fpc-pascal] Procedural parameters

2024-12-15 Thread Sven Barth via fpc-pascal
Am 14.12.2024 um 07:35 schrieb Adriaan van Os via fpc-pascal: Macpascal and Iso pascal have procedural parameters, e.g. function A( function B: double): double; Is there a $modeswitch to allow this ? I searched "procedure parameter" and "procedural parameter" in the Language Reference, bu

Re: [fpc-pascal] Procedural parameters

2024-12-15 Thread Adriaan van Os via fpc-pascal
Michael Van Canneyt via fpc-pascal wrote: On Sat, 14 Dec 2024, Adriaan van Os via fpc-pascal wrote: It's not because something is in the pascal standard, that FPC has it. It is. Appendix D6 of the Programmer's Reference says "This mode is selected by the $MODE ISO switch. On the com

Re: [fpc-pascal] Procedural parameters

2024-12-15 Thread Hairy Pixels via fpc-pascal
On Dec 15, 2024 at 6:28:25 PM, Hairy Pixels wrote: > Also noteworthy is ISO standard can accommodate generics which Borland’s > design can not. Wait, I’m wrong on this, you can use generic proc types. The problem with generics are pointers to T. For example that below is not possible. type

Re: [fpc-pascal] Procedural parameters

2024-12-15 Thread Hairy Pixels via fpc-pascal
On Dec 15, 2024 at 5:15:33 PM, Jonas Maebe via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > It's because unlike in Borland Pascal, procvars in ISO Pascal captured > the stack frame and allowed you to access local variables of the caller. > By only allowing the declaration in the procedu

Re: [fpc-pascal] Procedural parameters

2024-12-15 Thread Jonas Maebe via fpc-pascal
On 15/12/2024 07:01, Hairy Pixels via fpc-pascal wrote: On Dec 15, 2024 at 12:21:29 PM, Adriaan van Os via fpc-pascal > wrote: You mean the original pascal only allowed function declarations to be parameter types? Yes. And it is still true in the ISO 7185

Re: [fpc-pascal] Procedural parameters

2024-12-15 Thread Michael Van Canneyt via fpc-pascal
On Sat, 14 Dec 2024, Adriaan van Os via fpc-pascal wrote: Michael Van Canneyt via fpc-pascal wrote: On Sat, 14 Dec 2024, Adriaan van Os via fpc-pascal wrote: Macpascal and Iso pascal have procedural parameters, e.g. function A( function B: double): double; Is there a $modeswitch t

Re: [fpc-pascal] Procedural parameters

2024-12-15 Thread Adriaan van Os via fpc-pascal
Michael Van Canneyt via fpc-pascal wrote: Also, I wonder if "ISOPROGRAMPARAS" in the Programmer's Guide is spelled correctly. It is, as that is what is used in the compiler: globtype.pas:736 I don't mind, but it is rather weird/amusing Webster's dictionary para noun A piece of Turkish

Re: [fpc-pascal] Procedural parameters

2024-12-14 Thread Adriaan van Os via fpc-pascal
Hairy Pixels via fpc-pascal wrote: On Dec 15, 2024 at 12:21:29 PM, Adriaan van Os via fpc-pascal > wrote: You mean the original pascal only allowed function declarations to be parameter types? Yes. And it is still true in the ISO 7185 Pascal standard.

Re: [fpc-pascal] Procedural parameters

2024-12-14 Thread Hairy Pixels via fpc-pascal
On Dec 15, 2024 at 12:21:29 PM, Adriaan van Os via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > You mean the original pascal only allowed function declarations to be > parameter types? > > Yes. And it is still true in the ISO 7185 Pascal standard. > That doesn’t make any more sense tha

Re: [fpc-pascal] Procedural parameters

2024-12-14 Thread Adriaan van Os via fpc-pascal
Hairy Pixels via fpc-pascal wrote: On Dec 15, 2024 at 1:22:25 AM, Adriaan van Os via fpc-pascal > wrote: Similarly, you also cannot write: function A(B : (one,two,three)) : double; Not really. The function type declaration is a Borland invention, not o

Re: [fpc-pascal] Procedural parameters

2024-12-14 Thread Hairy Pixels via fpc-pascal
On Dec 15, 2024 at 1:22:25 AM, Adriaan van Os via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > Similarly, you also cannot write: > function A(B : (one,two,three)) : double; > > Not really. The function type declaration is a Borland invention, not > original Pascal. > > Regards, > > Adri

Re: [fpc-pascal] Procedural parameters

2024-12-14 Thread Adriaan van Os via fpc-pascal
Michael Van Canneyt via fpc-pascal wrote: On Sat, 14 Dec 2024, Adriaan van Os via fpc-pascal wrote: Macpascal and Iso pascal have procedural parameters, e.g. function A( function B: double): double; Is there a $modeswitch to allow this ? I searched "procedure parameter" and "procedura

Re: [fpc-pascal] Procedural parameters

2024-12-14 Thread Michael Van Canneyt via fpc-pascal
On Sat, 14 Dec 2024, Adriaan van Os via fpc-pascal wrote: Macpascal and Iso pascal have procedural parameters, e.g. function A( function B: double): double; Is there a $modeswitch to allow this ? I searched "procedure parameter" and "procedural parameter" in the Language Reference

[fpc-pascal] Procedural parameters

2024-12-13 Thread Adriaan van Os via fpc-pascal
Macpascal and Iso pascal have procedural parameters, e.g. function A( function B: double): double; Is there a $modeswitch to allow this ? I searched "procedure parameter" and "procedural parameter" in the Language Reference, but could not find anything. Also, I wonder if "ISOPROGRAM