Re: [fpc-pascal] Broken code with PEEPHOLE & REGVAR

2022-03-14 Thread Sven Barth via fpc-pascal
Peter via fpc-pascal schrieb am So., 13. März 2022, 22:58: > On 13/03/2022 18:19, Florian Klämpfl via fpc-pascal wrote: > > Thanks for tracking this down! I have cherry picked the commit to fixes. > > Great! It was a nasty bug. Good to see it fixed for the next release. > Would you please check

Re: [fpc-pascal] Broken code with PEEPHOLE & REGVAR

2022-03-11 Thread Sven Barth via fpc-pascal
Peter via fpc-pascal schrieb am Fr., 11. März 2022, 13:47: > I had a look at the assembler generated by 3.3.1 > > . > > # Var uix located in stack [rsp+83240] > movl%edx,%eax > movq%rax,83280(%rsp) > # Var AttackLoc *located in stack [rsp+83280]* > # [503] var > > . > >

Re: [fpc-pascal] Broken code with PEEPHOLE & REGVAR

2022-03-10 Thread Sven Barth via fpc-pascal
Peter via fpc-pascal schrieb am Fr., 11. März 2022, 00:48: > Pleased to report that with version > "Free Pascal Compiler version 3.3.1-10685-gf6ac49a139-unpushed-dirty > [2022/03/08] for x86_64" > > it seems fine. > So it seems it was fixed in main at least. Now the interesting question is 3.2.3

Re: [fpc-pascal] Broken code with PEEPHOLE & REGVAR

2022-03-10 Thread Sven Barth via fpc-pascal
Peter via fpc-pascal schrieb am Do., 10. März 2022, 23:39: > There are four source files, around 250k, to compile this library. I can > supply them if anyone wants to investigate. > Is this sufficient for a bug report? Does anyone know of any existing > bugs like this? Maybe already fixed? > Wo

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-16 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Mi., 16. Feb. 2022, 07:59: > > > > On Feb 16, 2022, at 2:46 AM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > // nested function/procedure/routine variable > > type > >

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-15 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Mi., 16. Feb. 2022, 03:14: > > > > On Feb 15, 2022, at 11:09 PM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > For a global function the compiler has to generate a wrapper that gets > rid of

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-15 Thread Sven Barth via fpc-pascal
Am 15.02.2022 um 15:05 schrieb Ryan Joseph via fpc-pascal: On Feb 15, 2022, at 8:26 PM, Sven Barth via fpc-pascal wrote: It's relatively "easy" to implement assigning a nested function to function references. However assigning a nested function variable to a function re

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-15 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Di., 15. Feb. 2022, 15:02: > > > > On Feb 15, 2022, at 8:32 PM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > A function reference is simply an interface of which the Invoke method > can

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-15 Thread Sven Barth via fpc-pascal
Michael Van Canneyt via fpc-pascal schrieb am Di., 15. Feb. 2022, 15:29: > > > On Tue, 15 Feb 2022, Ryan Joseph via fpc-pascal wrote: > > > > > > >> On Feb 15, 2022, at 8:26 PM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: >

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-15 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Di., 15. Feb. 2022, 13:14: > > > > On Feb 15, 2022, at 5:15 PM, Sven Barth > wrote: > > > > It contains a capture object that backs the method. > > If nothing is captured and the right hand side is a direct function or &

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-15 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Di., 15. Feb. 2022, 13:06: > > > > On Feb 15, 2022, at 3:32 PM, Michael Van Canneyt via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > I requested that this: > > > > procedure TMyObject.Demo; > > > > Procedure DoSub; > > begin > >Writeln

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-15 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Di., 15. Feb. 2022, 13:16: > > > > On Feb 15, 2022, at 7:10 PM, Michael Van Canneyt > wrote: > > > > In Delphi it is not. In FPC it should be :-) > > Indeed should be but that's what I'm trying to figure out with how this is > implemented. > > Why wouldn't D

Re: [fpc-pascal] Caller agnostic procedure variables

2022-02-15 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Di., 15. Feb. 2022, 08:34: > > > > On Feb 15, 2022, at 2:09 PM, Michael Van Canneyt via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > I've answered this question before: > > > > The "Reference to procedure" that will be part of anonymous > fu

Re: [fpc-pascal] bug or feature?

2022-02-13 Thread Sven Barth via fpc-pascal
Michael Van Canneyt via fpc-pascal schrieb am So., 13. Feb. 2022, 09:47: > > > On Sun, 13 Feb 2022, Mattias Gaertner via fpc-pascal wrote: > > > On Sat, 12 Feb 2022 12:14:14 +0100 (CET) > > Michael Van Canneyt via fpc-pascal > > wrote: > > > >> On Sat, 12 Feb 2022, Mattias Gaertner via fpc-pasca

Re: [fpc-pascal] bug or feature?

2022-02-12 Thread Sven Barth via fpc-pascal
Michael Van Canneyt via fpc-pascal schrieb am Sa., 12. Feb. 2022, 12:14: > > > On Sat, 12 Feb 2022, Mattias Gaertner via fpc-pascal wrote: > > > Hi, > > > > This can't be right, can it? > > > > type > > TBird = class > >procedure Fly; > > end; > > TEagle = TBird; // alias > > > > procedure

Re: [fpc-pascal] Strange behavior in generics.collections TDictionary

2022-01-26 Thread Sven Barth via fpc-pascal
Am 25.01.2022 um 18:48 schrieb Thomas Kurz via fpc-pascal: Consider the following code: *** PROGRAM project1; {$mode objfpc} {$longstrings on} // see output below {$modeswitch advancedrecords} USES Variants, Generics.Collections, SysUtils; TYPE TRecord = PACKED RECORD FID: NativeUInt; F

Re: [fpc-pascal] Macro expanding error

2022-01-25 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Mi., 26. Jan. 2022, 03:18: > I have this macro: > > {$define TCallback := TCallback2} > > which gives a long list of these errors. > > warning: Expanding of macros exceeds a depth of 16. > > What does this warning mean and how can I resolve it? > I did not l

Re: [fpc-pascal] Interface section overload procedures are all public

2022-01-23 Thread Sven Barth via fpc-pascal
Bart via fpc-pascal schrieb am So., 23. Jan. 2022, 21:43: > On Sun, Jan 23, 2022 at 6:12 PM Rainer Stratmann via fpc-pascal > wrote: > > > // making only one procedure bugtest public in the interface section > > // makes all other bugtest procedures public as well! > > // Lazarus 2.0.0+dfsg-2 >

Re: [fpc-pascal] Case statement for class introspection

2022-01-18 Thread Sven Barth via fpc-pascal
Am 19.01.2022 um 02:48 schrieb Ryan Joseph via fpc-pascal: On Jan 18, 2022, at 5:28 AM, Sven Barth wrote: The values will have the same differences between each other upon each start so ideally this would work anyway, but if one also throws dynamic packages into the mix things would get

Re: [fpc-pascal] Case statement for class introspection

2022-01-17 Thread Sven Barth via fpc-pascal
Am 17.01.2022 um 13:58 schrieb Ryan Joseph via fpc-pascal: On Jan 17, 2022, at 5:09 PM, Sven Barth wrote: The VMT writer already does that, cause the VMT pointer is required for each constructor call. The pointer to the VMT table is just PVmt(self) right? If I make a program and do

Re: [fpc-pascal] Case statement for class introspection

2022-01-17 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Mo., 17. Jan. 2022, 08:53: > > > > On Jan 17, 2022, at 1:55 PM, Sven Barth > wrote: > > > > Question then is how you get the VMT address as a constant at compile > time. > > > > I'll need to get back to you w

Re: [fpc-pascal] Case statement for class introspection

2022-01-16 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Mo., 17. Jan. 2022, 02:38: > > > > On Jan 16, 2022, at 11:15 PM, Sven Barth > wrote: > > > > The class type already is a unique "ID" for each class type when doing > an equal comparison. You can essentially take

Re: [fpc-pascal] Case statement for class introspection

2022-01-16 Thread Sven Barth via fpc-pascal
Am 16.01.2022 um 15:25 schrieb Ryan Joseph via fpc-pascal: On Jan 16, 2022, at 9:01 PM, Ryan Joseph wrote: case PtrUInt(o.ClassType) of 4500656856: writeln('TObject'); end; I may have spoken too soon and without thinking the through clearly (it's getting late here!). For this to wor

Re: [fpc-pascal] Crash on Windows for Aarch64 target

2022-01-13 Thread Sven Barth via fpc-pascal
Am 12.01.2022 um 14:37 schrieb Volo Zyko via fpc-pascal: Hello, Some time ago it was announced an experimental support for Windows on Aarch64 (namely in this post https://lists.freepascal.org/pipermail/fpc-pascal/2020-April/057762.html). I tried to build a dll with a proprietary code for that

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread Sven Barth via fpc-pascal
Bart via fpc-pascal schrieb am Mi., 12. Jan. 2022, 22:31: > On Wed, Jan 12, 2022 at 3:13 PM Michael Van Canneyt via fpc-pascal > wrote: > > > From the definition you can see it is a compilerproc function, meaning > that the > > compiler writes direct calls to this. > > To change the signature of

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread Sven Barth via fpc-pascal
DougC schrieb am Mi., 12. Jan. 2022, 17:57: > So, are you saying the one cannot declare an IntToStr function with the > string represented by a PChar argument? Seems pretty straightforward to me. > > Isn't that what is being requested? > No, it's not. He's requesting to change the functions that

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread Sven Barth via fpc-pascal
DougC via fpc-pascal schrieb am Mi., 12. Jan. 2022, 15:20: > Alexey- > > You can always create such a function yourself, gain experience using it, > and share the source with us. That way others can gain experience with it > and maybe someday also ask for it to be added to the standard library.

Re: [fpc-pascal] Improved FPC JSON-RPC support

2021-12-29 Thread Sven Barth via fpc-pascal
Am 29.12.2021 um 12:22 schrieb wkitty42--- via fpc-pascal: On 12/29/21 4:54 AM, Michael Van Canneyt via fpc-pascal wrote: Translated to RPC: if you want speed, don't use HTTP or JSON. WST offers a binary protocol and plain TCP channel, it's bound to be much faster. i'm sorry... what is WST? g

Re: [fpc-pascal] 64 bit Linux syscall from 32 bit fpc program

2021-12-24 Thread Sven Barth via fpc-pascal
Rainer Stratmann via fpc-pascal schrieb am Fr., 24. Dez. 2021, 15:04: > Is it possible to make a direct 64 bit Linux syscall from a 32 bit fpc > programm? > No, because your program is running as a 32-bit process and thus only has access to the 32-bit space of syscalls. Why, what do you want to

Re: [fpc-pascal] Is there a range limitation for the in operator?

2021-12-22 Thread Sven Barth via fpc-pascal
Bo Berglund via fpc-pascal schrieb am Mi., 22. Dez. 2021, 16:08: > So I wonder if there is a value range limitation for the arguments inside > an in > command like: > if a in [x..y] then > The right side of the in-operator is a set constructor. And sets may only contain up to 256 values. (Though

Re: [fpc-pascal] Getting Last User Input reliably

2021-12-05 Thread Sven Barth via fpc-pascal
James Richters via fpc-pascal schrieb am So., 5. Dez. 2021, 19:06: > Is there some way I can do {$Q-} before my check then restore it to > whatever it was before after it? (for example if it was already set to > {$Q-} in the compiler, I would not want to turn it back on) > Is there a way to do a

Re: [fpc-pascal] Named optional arguments

2021-11-30 Thread Sven Barth via fpc-pascal
Am 28.11.2021 um 14:21 schrieb Ryan Joseph via fpc-pascal: On Nov 28, 2021, at 7:01 PM, Sven Barth wrote: Anything that relates to picking functions *must* be part of the overload handling. You can easily see this with your named argument proposal when not all arguments are named (and then

Re: [fpc-pascal] Named optional arguments

2021-11-30 Thread Sven Barth via fpc-pascal
Am 28.11.2021 um 12:52 schrieb Ryan Joseph via fpc-pascal: On Nov 28, 2021, at 4:18 PM, Mattias Gaertner via fpc-pascal wrote: What do you mean? Is there already some call by arg names in some mode(switch)? I mean all the plumbing is there so the feature could easily be extended from IDisp

Re: [fpc-pascal] Named optional arguments

2021-11-28 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am So., 28. Nov. 2021, 03:12: > > > > On Nov 27, 2021, at 5:00 PM, Sven Barth > wrote: > > > > The compiler does not know which routine is called upon parsing the > parameter declarations (which would mean that error reports wou

Re: [fpc-pascal] Named optional arguments

2021-11-28 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am So., 28. Nov. 2021, 05:32: > > > > On Nov 27, 2021, at 5:03 PM, Sven Barth > wrote: > > > > candidates:=tcallcandidates.create(sym:=symtableprocentry, > st:=symtableproc,ppn:=left, > ignorevisibility:=ignorevisibility,allowd

Re: [fpc-pascal] Named optional arguments

2021-11-27 Thread Sven Barth via fpc-pascal
Am 27.11.2021 um 03:32 schrieb Ryan Joseph via fpc-pascal: On Nov 26, 2021, at 4:20 PM, Ryan Joseph wrote: It's mainly useful when reading code so you don't need to review the function definition, using code tools or any other method. I've been enjoying it in other languages when it's not c

Re: [fpc-pascal] Named optional arguments

2021-11-27 Thread Sven Barth via fpc-pascal
Am 26.11.2021 um 05:10 schrieb Ryan Joseph via fpc-pascal: This was discussed before some years ago with no conclusion (https://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg46280.html) but I'd like to bring it up again. Can we consider extending the variant dispatch call named param

Re: [fpc-pascal] Inline function parameters

2021-11-10 Thread Sven Barth via fpc-pascal
Am 11.11.2021 um 02:52 schrieb Ryan Joseph via fpc-pascal: On Nov 9, 2021, at 1:09 PM, Sven Barth via fpc-pascal wrote: No, because the function that is called with a function pointer needs to be inlined itself (thus becoming part of its caller) so that constant propagation works at all

Re: [fpc-pascal] Inline function parameters

2021-11-08 Thread Sven Barth via fpc-pascal
Am 09.11.2021 um 02:45 schrieb Ryan Joseph via fpc-pascal: On Nov 8, 2021, at 11:20 PM, Sven Barth via fpc-pascal wrote: I don't know what you mean with "new function body". If a function is inlined its code is contained within the surrounding function and if it's not i

Re: [fpc-pascal] Inline function parameters

2021-11-08 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Mo., 8. Nov. 2021, 15:31: > > > > On Nov 8, 2021, at 1:27 PM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > And there you have it (simplified obviously). As long as the compiler > can det

Re: [fpc-pascal] Inline function parameters

2021-11-07 Thread Sven Barth via fpc-pascal
Am 08.11.2021 um 03:45 schrieb Ryan Joseph via fpc-pascal: On Nov 7, 2021, at 2:17 PM, Jonas Maebe via fpc-pascal wrote: Is there anyway a function parameter could be inlined in FPC? This would go a long way in helping to parameterize functions that have tight loops in them. It's theoreti

Re: [fpc-pascal] String error on Windows

2021-11-01 Thread Sven Barth via fpc-pascal
Am 31.10.2021 um 12:20 schrieb Ryan Joseph via fpc-pascal: On Oct 31, 2021, at 2:53 PM, Jonas Maebe via fpc-pascal wrote: The compiler itself does enable them by the default on any platform. However, the fpc.cfg file that gets installed with FPC on all platforms does enable them by default

Re: [fpc-pascal] String error on Windows

2021-10-31 Thread Sven Barth via fpc-pascal
Jonas Maebe via fpc-pascal schrieb am So., 31. Okt. 2021, 08:54: > On 31/10/2021 05:35, Ryan Joseph via fpc-pascal wrote: > > I thought they were behind a mode switch called "c operators" or > something but either way I don't see why Windows would disable them. > > The compiler itself does enable

Re: [fpc-pascal] Unable to link static lib files on Window

2021-10-26 Thread Sven Barth via fpc-pascal
Am 25.10.2021 um 22:38 schrieb Anthony Walter via fpc-pascal: I know I was previously able to link static library files on Windows with FPC, but hadn't used this feature in a while. When I recently tried using static linking I am receiving error messages leaving me to believe something has chan

Re: [fpc-pascal] Status of anonymous functions

2021-10-08 Thread Sven Barth via fpc-pascal
Luis Henrique Barbosa de Lima via fpc-pascal < fpc-pascal@lists.freepascal.org> schrieb am Fr., 8. Okt. 2021, 18:14: > Is there any progress or news about anonymous functions? I'm curious to > know if the development is alive and when/if it will land on trunk in near > future. > It's still work i

Re: [fpc-pascal] TEnumerator - After the last element?

2021-10-07 Thread Sven Barth via fpc-pascal
Am 07.10.2021 um 16:10 schrieb Gabor Boros via fpc-pascal: Hi All, I need to know the current position is after the last element. The attached solution demonstrate what I want. Is an internal solution exists for this task? I not found anything. MoveNext returns False once the enumerator has

Re: [fpc-pascal] How to list IP and MAC of network adapters on Windows?

2021-09-10 Thread Sven Barth via fpc-pascal
Bo Berglund via fpc-pascal schrieb am Fr., 10. Sep. 2021, 09:41: > Is there a way to enumerate the active adapters on a Windows computer with > their > IPv4 and MAC addresses? > There is an API for that, but I don't remember that right now. > I am trying to convert a Linux reporting script to

Re: [fpc-pascal] Raise exception in libray which will not halt host application

2021-08-26 Thread Sven Barth via fpc-pascal
Am 26.08.2021 um 12:59 schrieb LacaK via fpc-pascal: Am 26.08.2021 um 10:10 schrieb LacaK via fpc-pascal: Thank you for both answers! Please note that you won't be able to catch such an exception with the type from within the application, e.g.: === code begin === try   SomeLibraryFuncti

Re: [fpc-pascal] Raise exception in libray which will not halt host application

2021-08-26 Thread Sven Barth via fpc-pascal
Am 26.08.2021 um 10:10 schrieb LacaK via fpc-pascal: Thank you for both answers! Please note that you won't be able to catch such an exception with the type from within the application, e.g.: === code begin === try   SomeLibraryFunction; except   on e: TMyObject do Whatever;   else    

Re: [fpc-pascal] FPC & Lazarus moving to gitlab

2021-07-13 Thread Sven Barth via fpc-pascal
Am 10.07.2021 um 16:14 schrieb Florian Klämpfl via fpc-pascal: There is a third conversion of the FPF repository meanwhile (from June): https://gitlab.com/freepascal.org/fpc/testconversion3  Please check and report any problems, this is mos

Re: [fpc-pascal] How does FPC perform in the FASTEST Computer Language Race

2021-07-11 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am So., 11. Juli 2021, 01:19: > > > > On Jul 10, 2021, at 11:18 AM, Jonas Maebe via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > A constexpr function means that it must be computable at compile time if > > all of its arguments are also constexp

Re: [fpc-pascal] Tuples as variant arrays

2021-06-26 Thread Sven Barth via fpc-pascal
Am 26.06.2021 um 00:12 schrieb Ryan Joseph via fpc-pascal: Is it possible something like this could work? Seems like it should but I get an error (got MyRecord expected variant). {$mode objfpc} program unit_name; type TTuple = array of variant; type

Re: [fpc-pascal] Fwd: Linker error on simple program (windows)

2021-06-24 Thread Sven Barth via fpc-pascal
Am 24.06.2021 um 19:06 schrieb Bart via fpc-pascal: On Thu, Jun 24, 2021 at 11:10 AM Sven Barth wrote: Thus for 3.2.0 and 3.2.2 you indeed need to use the workarounds you mentioned. Not a problem. It just surprised me. Will this be fixed in 3.2.4? It's not even sure if there will

Re: [fpc-pascal] Linker error on simple program (windows)

2021-06-24 Thread Sven Barth via fpc-pascal
Bart via fpc-pascal schrieb am Mi., 23. Juni 2021, 18:59: > The error goes away if I remove the inline directive from the function > definition in the interface section, or if I also declare the other > function (which gives the linker error) in the interface section. > The compiler shouldn't do

Re: [fpc-pascal] Push rules

2021-06-22 Thread Sven Barth via fpc-pascal
Michael Van Canneyt via fpc-pascal schrieb am Di., 22. Juni 2021, 13:44: > > Hello, > > Martin asked how we intend to go about git commit authors/emails. > These can of course be manipulated at will in Git. > > But gitlab can place some restrictions on what is pushed to the repo: > > https://docs

Re: [fpc-pascal] Will the size of an executable depend on the uses clause

2021-06-16 Thread Sven Barth via fpc-pascal
Bo Berglund via fpc-pascal schrieb am Mi., 16. Juni 2021, 13:32: > On Wed, 16 Jun 2021 12:30:55 +0200, Mattias Gaertner via fpc-pascal > wrote: > > >> Since the final binary size after using strip -s on the exe file is > >> 271 kb it seems a bit big! > >> Or is there a lot behind the scenes I ha

Re: [fpc-pascal] Management operators memleaks

2021-06-13 Thread Sven Barth via fpc-pascal
Am 11.06.2021 um 18:15 schrieb denisgolovan via fpc-pascal: Hi all I created a test case for rather unusual behaviour of management operators in fpc 3.3.1. In some specific cases they produce memory leaks. I suspect it's some compiler issue. Could somebody take a look at https://bugs.freepasca

Re: [fpc-pascal] Option type

2021-06-02 Thread Sven Barth via fpc-pascal
denisgolovan via fpc-pascal schrieb am Mi., 2. Juni 2021, 13:28: > > > > Well as already discovered type like strings can not go into a "record > case" > > > > But... The above record is anyway of constant size. I.e. the memory for > > the field is always included, even if it is not used. > > > >

Re: [fpc-pascal] Option type

2021-06-01 Thread Sven Barth via fpc-pascal
Am 02.06.2021 um 03:45 schrieb denisgolovan: You simply can't use managed types in a variant clause and as T could be a managed type the compiler does not allow it. Well. I thought it should be precisely the case for variant clause to properly handle. Compiler knows IsSome field is used to de

Re: [fpc-pascal] Option type

2021-06-01 Thread Sven Barth via fpc-pascal
Am 01.06.2021 um 20:20 schrieb denisgolovan via fpc-pascal: Hi all I am trying to implement Option type in FPC. type generic TOption = record case IsSome:boolean of true: ( some: T ); false: (); end; However fpc just emits errors: Error: Type parameters may require initial

Re: [fpc-pascal] -FNsystem

2021-05-27 Thread Sven Barth via fpc-pascal
Mattias Gaertner via fpc-pascal schrieb am Do., 27. Mai 2021, 13:32: > Hi, > > There are some dotted units in fpc, e.g. system.uitypes. > So it would be nice to have -FNsystem in the default fpc.cfg (Delphi > compatible). > > What do you think? > While I agree that adding the namespaces might be

Re: [fpc-pascal] FTP support gone - switch to HTTP ?

2021-05-18 Thread Sven Barth via fpc-pascal
Tomas Hajny via fpc-pascal schrieb am Di., 18. Mai 2021, 11:44: > On 2021-05-18 10:38, Michael Van Canneyt via fpc-pascal wrote: > > On Tue, 18 May 2021, Graeme Geldenhuys via fpc-pascal wrote: > > > >> > >> On 17/05/2021 3:13 pm, Karoly Balogh via fpc-pascal wrote: > >>> I'd actually keep > >>>

Re: [fpc-pascal] 50 years of Pascal, by the the author himself

2021-05-12 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Mi., 12. Mai 2021, 22:08: > > > > On May 12, 2021, at 12:30 PM, Ralf Quint via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > Thought this was kind of interesting, though it leaves short of > mentioning the later Object Pascal evolution and th

Re: [fpc-pascal] Array range overflow in properties

2021-04-29 Thread Sven Barth via fpc-pascal
Am 29.04.2021 um 20:14 schrieb Ryan Joseph via fpc-pascal: Is this a bug in properties and I should be getting an error? type TPixel = record components: array[0..3] of byte; property R: byte read components[10] write components[10]; end; Well, there should *a

Re: [fpc-pascal] Detecting IO errors with INI file

2021-04-29 Thread Sven Barth via fpc-pascal
James Richters schrieb am Do., 29. Apr. 2021, 10:33: > I get Error: Identifier not found “Try” > > Because my unit must be compiled with {$MODE TP} > You can try to use {$modeswitch exceptions}, I think. Otherwise quite a few procedures and functions won’t even compile that only > work in Turbo

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-28 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Mi., 28. Apr. 2021, 17:53: > > > > On Apr 27, 2021, at 11:36 PM, Sven Barth > wrote: > > > > Anyway, it would in principle be possible to convert an anonymous > function to a "is nested" function, but that will only

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-28 Thread Sven Barth via fpc-pascal
Martin Frb via fpc-pascal schrieb am Mi., 28. Apr. 2021, 19:26: > On 28/04/2021 18:43, Graeme Geldenhuys via fpc-pascal wrote: > > Hello Sven, > > > > On 28/04/2021 6:32 am, Sven Barth via fpc-pascal wrote: > >> Second: the syntax is required for Delphi compatib

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-28 Thread Sven Barth via fpc-pascal
Graeme Geldenhuys via fpc-pascal schrieb am Mi., 28. Apr. 2021, 19:00: > Hello Sven, > > On 28/04/2021 6:32 am, Sven Barth via fpc-pascal wrote: > > Second: the syntax is required for Delphi compatibility anyway > > Couldn't such verbose syntax be limited to {$mode del

Re: [fpc-pascal] Detecting IO errors with INI file

2021-04-28 Thread Sven Barth via fpc-pascal
James Richters via fpc-pascal schrieb am Do., 29. Apr. 2021, 03:13: > {$i-} > > Log_Ini := TIniFile.Create(‘my.ini’); // blows up with 217 > > Writeln(ioresult); > > {$i+} > > > > The error I get is: > > An unhandled exception occurred at $005A57D0: > > EFOpenError: Unable to open file "LOG.INI

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-27 Thread Sven Barth via fpc-pascal
Am 28.04.2021 um 00:53 schrieb Graeme Geldenhuys via fpc-pascal: On 27/04/2021 10:13 pm, Ryan Joseph via fpc-pascal wrote: value.SortEntities(function(a, b: TEntity): integer begin // do stuff end ); It seem the beginning of the thread is missing, but I wou

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-27 Thread Sven Barth via fpc-pascal
Am 27.04.2021 um 19:56 schrieb Michael Van Canneyt via fpc-pascal: On Tue, 27 Apr 2021, Ryan Joseph via fpc-pascal wrote: On Apr 27, 2021, at 9:58 AM, Michael Van Canneyt wrote: Wait. I asked Sven to make sure that nested functions are under ALL circumstances usable as closures or ca

Re: [fpc-pascal] Generic constants with generic type

2021-04-21 Thread Sven Barth via fpc-pascal
Am 21.04.2021 um 17:59 schrieb Andrey Zubarev via fpc-pascal: Ok. Thanks! For this already there is a bug report? to notice when it will work? Best keep an eye on this one and then test again once it's solved: https://bugs.freepascal.org/view.php?id=25678 Regards, Sven __

Re: [fpc-pascal] Generic constants with generic type

2021-04-21 Thread Sven Barth via fpc-pascal
Andrey Zubarev via fpc-pascal schrieb am Mi., 21. Apr. 2021, 09:23: > Hi all! > With the existing syntax of constants, it is good to pass array > boundaries, but bad to initial parameter values. What do you think about > such constructs: > > GTValue=... > It is currently simply not possible to r

Re: [fpc-pascal] How does TFPGMap key compare work?

2021-04-20 Thread Sven Barth via fpc-pascal
Am 21.04.2021 um 00:09 schrieb Ryan Joseph via fpc-pascal: On Apr 20, 2021, at 3:10 PM, Sven Barth wrote: If you look at TFPSMap' code you'll see that BinaryCompareKey and BinaryCompareData are only used in the way of method pointers OnKeyPtrCompare and OnDataPtrCompare. I

Re: [fpc-pascal] How does TFPGMap key compare work?

2021-04-20 Thread Sven Barth via fpc-pascal
Am 19.04.2021 um 19:05 schrieb Ryan Joseph via fpc-pascal: I have a question I was just curious about. From what I can tell TFPGMap uses CompareByte to compare keys of arbitrary type, which is clever but how does this work for ShortStrings? I have tried to use this method myself and I find it

Re: [fpc-pascal] Abstract classes ignored

2021-04-18 Thread Sven Barth via fpc-pascal
Am 18.04.2021 um 19:58 schrieb Ryan Joseph via fpc-pascal: On Apr 18, 2021, at 5:00 AM, Sven Barth wrote: As I have said: Delphi compatibility. This would have been a good candidate to put behind the delphi mode switch but I'm sure there is a reason for this also. Nowadays: back

Re: [fpc-pascal] Separate release cycle for RTL and compiler proposal

2021-04-18 Thread Sven Barth via fpc-pascal
Am 18.04.2021 um 23:29 schrieb Zamrony P. Juhara via fpc-pascal: I would like to propose to separate RTL release   from compiler release so that RTL bug fixes and features can be released with shorter release cycle. Is that possible? No, the RTL and the compiler are tightly coupled. What mi

Re: [fpc-pascal] Abstract classes ignored

2021-04-18 Thread Sven Barth via fpc-pascal
Graeme Geldenhuys via fpc-pascal schrieb am So., 18. Apr. 2021, 17:54: > > On 18/04/2021 11:31 am, C Western via fpc-pascal wrote: > > but there are also case where it never makes sense to > > implement them and calling them indicates a logical error elsewhere in > > the code. > > So do the logi

Re: [fpc-pascal] Abstract classes ignored

2021-04-18 Thread Sven Barth via fpc-pascal
Jonas Maebe via fpc-pascal schrieb am So., 18. Apr. 2021, 21:19: > On 18/04/2021 18:08, Jonas Maebe via fpc-pascal wrote: > > In this case, you > > can easily make it an error yourself with {$warn 4046 error}. > > Correction: that's make it an error to construct a classes that contain > abstract

Re: [fpc-pascal] Abstract classes ignored

2021-04-18 Thread Sven Barth via fpc-pascal
Am 18.04.2021 um 04:34 schrieb Ryan Joseph via fpc-pascal: On Apr 17, 2021, at 3:09 PM, Sven Barth wrote: The compiler will generate a warning in case you instantiate a class that is abstract or has abstract methods. You can escalate these warnings to errors if you need: It's probabl

Re: [fpc-pascal] Background info on Generics in FPC

2021-04-17 Thread Sven Barth via fpc-pascal
Am 17.04.2021 um 21:07 schrieb Graeme Geldenhuys via fpc-pascal: I'm looking at the wiki and official FPC language documentation. What was the reason for the decision to make the FPC syntax so verbose regarding Generics? I don't know what the original reason was, but nowadays it's main advanta

Re: [fpc-pascal] Abstract classes ignored

2021-04-17 Thread Sven Barth via fpc-pascal
Am 17.04.2021 um 20:30 schrieb Ryan Joseph via fpc-pascal: From the documentation: "An abstract class is a class that cannot be instantiated directly. Instead, a descendent class must always be instantiated. However, for Delphi compatibility, the compiler ignores this directive." Why does thi

Re: [fpc-pascal] Generic class aliases

2021-04-16 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Fr., 16. Apr. 2021, 18:29: > With normal classes you can make aliases to other units but with generics > you get an error. Am I doing this wrong or is this not supported? > > type > TList = UOther.TList; // Generics without specialization cannot be used >

Re: [fpc-pascal] Interruption handling on i8086

2021-04-10 Thread Sven Barth via fpc-pascal
Am 10.04.2021 um 12:15 schrieb Guillermo via fpc-pascal: El Sat, 10 Apr 2021 10:42:12 +0200 Christo Crause escribió: On Sat, Apr 10, 2021 at 10:14 AM Guillermo via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: Hi pascaloids, I'm doing DOS development for fun and, after installing the

Re: [fpc-pascal] Usage of FieldAddress

2021-04-05 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Mo., 5. Apr. 2021, 05:58: > > > > On Apr 4, 2021, at 2:36 PM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > The RTTI streaming relies on *published properties* (and published > methods for

Re: [fpc-pascal] Usage of FieldAddress

2021-04-04 Thread Sven Barth via fpc-pascal
Am 04.04.2021 um 22:19 schrieb Ryan Joseph via fpc-pascal: On Apr 4, 2021, at 1:07 PM, Sven Barth via fpc-pascal wrote: Only classes or interfaces are supported as published *fields*. And the visibility of the *property* does not change the visibility of the *field*, after all the

Re: [fpc-pascal] Usage of FieldAddress

2021-04-04 Thread Sven Barth via fpc-pascal
Am 04.04.2021 um 20:15 schrieb Ryan Joseph via fpc-pascal: On Apr 4, 2021, at 12:10 PM, Sven Barth via fpc-pascal wrote: FieldAddress only works on published fields. Just like MethodAddress only works on published methods. For private fields extended RTTI is required which is not yet

Re: [fpc-pascal] Usage of FieldAddress

2021-04-04 Thread Sven Barth via fpc-pascal
Am 04.04.2021 um 19:12 schrieb Ryan Joseph via fpc-pascal: I'm trying to see fields by name but TObject.FieldAddress doesn't seem to be working. Do I have that correct I should be using FieldAddress to return the pointer of the published property? Some how I can't seem to find an example of Fi

Re: [fpc-pascal] Minimal size of compiled library (DLL under Windows)

2021-04-03 Thread Sven Barth via fpc-pascal
LacaK via fpc-pascal schrieb am Sa., 3. Apr. 2021, 13:22: > Hi, > I did small test project for library: > (with -CX -WR -O3 -Xs -XX options set) > > library library1; > {$mode objfpc}{$H+} > uses > SysUtils, Classes; > begin > end. > > Compilation produces DLL with size 200+ KB. > > When in use

Re: [fpc-pascal] Extraneous generic parameters

2021-03-15 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Mo., 15. März 2021, 20:45: > > > > On Mar 15, 2021, at 12:42 AM, Sven Barth > wrote: > > > > The TArray generic type is part of the ObjPas unit, so the compiler > simply picks that instead of that of your program. ;) > >

Re: [fpc-pascal] Extraneous generic parameters

2021-03-14 Thread Sven Barth via fpc-pascal
Am 14.03.2021 um 19:10 schrieb Ryan Joseph via fpc-pascal: This program compiles, but is it a bug? I would think the specialization should fail because "S" in TArray is not specified. {$mode objfpc} type generic TArray = array of T; generic procedure DoThis(par

Re: [fpc-pascal] JSONStringToString question

2021-03-14 Thread Sven Barth via fpc-pascal
Michael Van Canneyt via fpc-pascal schrieb am So., 14. März 2021, 18:03: > > > On Sun, 14 Mar 2021, Bart via fpc-pascal wrote: > > > On Sun, Mar 14, 2021 at 4:15 PM Michael Van Canneyt via fpc-pascal > > wrote: > > > >> Fixed. Thanks for the patch. > >> There was a second issue, which is now als

Re: [fpc-pascal] Smart-linking versus Whole Program Optimization

2021-03-10 Thread Sven Barth via fpc-pascal
LacaK via fpc-pascal schrieb am Mi., 10. März 2021, 10:34: > Hi, > > my goal is DO NOT include unused procedures, methods in final > program/library on Win32 target exe/dll. > > A.) I compile my (units) program/library with -CX -XX (set in Project > Options) > > B.) I did also experiments with WP

Re: [fpc-pascal] Unicode chars losing information

2021-03-08 Thread Sven Barth via fpc-pascal
Graeme Geldenhuys via fpc-pascal schrieb am Di., 9. März 2021, 00:56: > > On 07/03/2021 5:48 pm, Nikolay Nikolov via fpc-pascal wrote: > > It depends on what you mean by "just working". > > No, "just worked" is exactly what it says on the tin. It is FPC that > overcomplicating matters. > > > As a

Re: [fpc-pascal] Why has the tkFloat default value changed?

2021-03-06 Thread Sven Barth via fpc-pascal
Ondrej Pokorny schrieb am Sa., 6. März 2021, 04:29: > On 05.03.2021 20:34, Sven Barth wrote: > > Am 28.02.2021 um 23:11 schrieb Mattias Gaertner via fpc-pascal: > > [...] > >> I can't find this change in > >> https://wiki.lazarus.freepascal.org/User_

Re: [fpc-pascal] Why has the tkFloat default value changed?

2021-03-05 Thread Sven Barth via fpc-pascal
Am 28.02.2021 um 23:11 schrieb Mattias Gaertner via fpc-pascal: Hi, In FPC 3.2.0 the default "Default" value of a single/double property has changed from $8000 (fpc 3.0.4) to 0. This breaks TWriter. The $8000 means the property has no default value. Now FPC 3.2.0 no longer writes a prop

Re: [fpc-pascal] Strange output from make when building 3.2.0

2021-02-25 Thread Sven Barth via fpc-pascal
Am 25.02.2021 um 13:38 schrieb Bo Berglund via fpc-pascal: On Thu, 25 Feb 2021 10:59:14 +0100, Marco van de Voort via fpc-pascal wrote: Op 2021-02-25 om 10:12 schreef Bo Berglund via fpc-pascal: I am installing fpc 3.2.0 on a notebook running Ubuntu 20.04 LTS When I execute make clean and mak

Re: [fpc-pascal] Generic routines for both dynamic array and other collections

2021-02-22 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Mo., 22. Feb. 2021, 13:07: > > > > On Feb 21, 2021, at 2:59 PM, Sven Barth > wrote: > > > > You are supposed to use Length(X). There is no need for a "property". > One doesn't need to objectify each and e

Re: [fpc-pascal] Traits Proposal

2021-02-22 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Mo., 22. Feb. 2021, 10:07: > > > > On Feb 19, 2021, at 8:50 AM, Ryan Joseph wrote: > > > > I just realized another potential problem. If we use the "default" > keyword that means there could be multiple "defaults" unless we limit the > property to 1 per clas

Re: [fpc-pascal] Generic routines for both dynamic array and other collections

2021-02-21 Thread Sven Barth via fpc-pascal
James Richters schrieb am Mo., 22. Feb. 2021, 01:07: > I've been using a lot of dynamic arrays of records lately, Some are even > Dynamic Arrays of records that contain other records, for example: > Type >XYZ_Record = Record > X,Y,Z : Double >End; > >Call_Stack_Record = Record

<    1   2   3   4   5   6   7   8   9   10   >