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] 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
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: backwards compa

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] 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. In TFPGMap<,> these

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] 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] [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] [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] 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-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] [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
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 come *after* the > whole implementation is

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] 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] 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] 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] -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] 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] 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-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] 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] 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] 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] 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] 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 be a 3.2.

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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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-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-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] 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] 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-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,allowdefaultparas:=not(nf_isproperty in

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 would need to > be deferred until th

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-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] 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] 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] 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] 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] 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] 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
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] 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] 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] 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 the address of the VMT as the > constant value

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 with that. > > > > I didn't test yet but I think wh

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: writ

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 mes

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] 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] 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] 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] 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] 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] 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, 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: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 > method pointer then the compiler coul

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, 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
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 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-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] 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] 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-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-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] RTLEventWaitFor

2022-04-05 Thread Sven Barth via fpc-pascal
Mattias Gaertner via fpc-pascal schrieb am Di., 5. Apr. 2022, 10:36: > On Tue, 5 Apr 2022 10:23:45 +0200 (CEST) > Michael Van Canneyt via fpc-pascal > wrote: > > >[...] > > RTLEventWaitFor uses WaitForSingleObject internally. > > > > According to this: > > > > https://docs.microsoft.com/en-gb/wi

[fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-20 Thread Sven Barth via fpc-pascal
Dear FPC community, The FPC developers are pleased to announce the implementation of a new feature: implicit generic function specializations. This feature was implemented by Ryan Joseph, so thank you very much, Ryan. This feature allows you to use generic routines (functions, procedures, me

Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-22 Thread Sven Barth via fpc-pascal
Am 22.04.2022 um 15:48 schrieb Rainer Stratmann via fpc-pascal: Am Mittwoch, 20. April 2022, 19:15:15 CEST schrieb Sven Barth via fpc-pascal: This feature is enabled with the modeswitch ImplicitFunctionSpecialization and is for now not enabled by default as this has the potential to break

Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-22 Thread Sven Barth via fpc-pascal
Am 22.04.2022 um 20:51 schrieb Martin Frb via fpc-pascal: I created a little test program (see bottom of mail). And it gives a strange warning: Compile Project, Target: C:\Users\martin\AppData\Local\Temp\project1.exe: Success, Warnings: 1, Hints: 3 project1.lpr(67,52) Warning: Range check err

Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-22 Thread Sven Barth via fpc-pascal
Am 22.04.2022 um 22:22 schrieb Mattias Gaertner via fpc-pascal: On Fri, 22 Apr 2022 20:51:56 +0200 Martin Frb via fpc-pascal wrote: [...] Well, I tested: It uses the type of the first Param. So it calls a function for both param of type Byte. The cardinal argument is converted. (potentially tr

Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-23 Thread Sven Barth via fpc-pascal
Am 23.04.2022 um 00:42 schrieb Martin Frb via fpc-pascal: Possible one more / Though more of an optimization. If the code has multiple     Add(Int64(0), Int64(0)); then they will all use the same procedure (just break in the debugger and check the CRC). But if  one specialization is explicit

Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-23 Thread Sven Barth via fpc-pascal
Am 22.04.2022 um 23:08 schrieb Rainer Stratmann via fpc-pascal: Am Freitag, 22. April 2022, 19:53:34 CEST schrieben Sie: Am 22.04.2022 um 15:48 schrieb Rainer Stratmann via fpc-pascal: Am Mittwoch, 20. April 2022, 19:15:15 CEST schrieb Sven Barth via fpc- pascal: We don't de

Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-25 Thread Sven Barth via fpc-pascal
Hairy Pixels via fpc-pascal schrieb am Mo., 25. Apr. 2022, 10:58: > > > > On Apr 25, 2022, at 2:39 PM, Martin Frb via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > Actually, it's dealing with SmallInt (or ShortInt). And if the > programmer does not know that, then it might be an

Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-25 Thread Sven Barth via fpc-pascal
Mattias Gaertner via fpc-pascal schrieb am Mo., 25. Apr. 2022, 13:50: > > >[...] > > type > > generic TArrayHelper = type helper for array of T > > procedure Add(value: T); > > end; > > > > var > > a: array of integer; > > begin > > a.Add(1); // specialize TArrayHelper since the comp

Re: [fpc-pascal] Correct way for using TThread.ForceQueue?

2022-04-25 Thread Sven Barth via fpc-pascal
Am 25.04.2022 um 17:30 schrieb Michael Van Canneyt via fpc-pascal: On Mon, 25 Apr 2022, Thomas Kurz via fpc-pascal wrote: I cannot remember why, but a long time ago when learning Delphi 5 or 6, I have learned not to call the destructor from within any method of the class, only from outside. 

[fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-26 Thread Sven Barth via fpc-pascal
Dear Free Pascal Community, The Free Pascal Developer team is pleased to finally announce the addition of a long awaited feature, though to be precise it's two different, but very much related features: Function References and Anonymous Functions. These two features can be used independantly o

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-26 Thread Sven Barth via fpc-pascal
Am 27.05.2022 um 00:46 schrieb Mattias Gaertner via fpc-pascal: On Thu, 26 May 2022 21:47:06 +0200 Sven Barth via fpc-pascal wrote: As these two features are rather complicated there might still be a huge bundle of bugs lurking around so I ask you to test them to year heart's conten

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-27 Thread Sven Barth via fpc-pascal
Marco van de Voort via fpc-pascal schrieb am Fr., 27. Mai 2022, 13:31: > > On 27-5-2022 00:46, Mattias Gaertner via fpc-pascal wrote: > > > >> As these two features are rather complicated there might still be a > >> huge bundle of bugs lurking around so I ask you to test them to year > >> heart's

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-29 Thread Sven Barth via fpc-pascal
Am 28.05.2022 um 14:04 schrieb Benito van der Zander via fpc-pascal: Hi, Sort((left, right) begin if left < right then result := -1 else if left > right then result := 1 else

Re: [fpc-pascal] Be careful of too many features

2022-05-30 Thread Sven Barth via fpc-pascal
Steve Litt via fpc-pascal schrieb am Mo., 30. Mai 2022, 21:25: > With the addition of callback functions, and the closures and events > they bring to the table, you can go procedural, OOP, or to a degree > functional. I think adding yet more features obfuscates and Perlizes > Pascal. > We are ad

Re: [fpc-pascal] Be careful of too many features

2022-05-30 Thread Sven Barth via fpc-pascal
Steve Litt via fpc-pascal schrieb am Di., 31. Mai 2022, 04:12: > Hairy Pixels via fpc-pascal said on Tue, 31 May 2022 08:39:20 +0700 > > FPC is very good about keeping > >new features behind mode switches you can disable all the cruft if you > >ever want to create plain procedural Pascal like in

Re: [fpc-pascal] Are there any drawbacks to "reference to"?

2022-06-19 Thread Sven Barth via fpc-pascal
Jonas Maebe via fpc-pascal schrieb am So., 5. Juni 2022, 21:02: > On 2022-06-05 18:20, Anthony Walter via fpc-pascal wrote: > > > As the "reference to" feature was recently added to fpc trunk, I'd like > > to ask if internally there are any penalties (performance perhaps) or > > drawbacks to usin

Re: [fpc-pascal] Are there any drawbacks to "reference to"?

2022-06-19 Thread Sven Barth via fpc-pascal
Hairy Pixels schrieb am So., 19. Juni 2022, 15:44: > > > > On Jun 19, 2022, at 7:01 PM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > As I can see neither Anthony's nor Ryan's mail, but I can see them in > the archive

Re: [fpc-pascal] Are there any drawbacks to "reference to"?

2022-06-19 Thread Sven Barth via fpc-pascal
Am 20.06.2022 um 03:37 schrieb Hairy Pixels: On Jun 19, 2022, at 10:04 PM, Sven Barth wrote: As you can see the allocation only happens once and not all the time. What might be worse however is the optimization behavior as in this example the compiler wouldn't optimize the counter variable i

Re: [fpc-pascal] Are there any drawbacks to "reference to"?

2022-06-20 Thread Sven Barth via fpc-pascal
Michael Van Canneyt schrieb am Mo., 20. Juni 2022, 08:04: > > > On Mon, 20 Jun 2022, Sven Barth via fpc-pascal wrote: > > > Am 20.06.2022 um 03:37 schrieb Hairy Pixels: > >> > >>> On Jun 19, 2022, at 10:04 PM, Sven Barth > > > wrote: > >&g

Re: [fpc-pascal] Calling undefined function pointers in generics

2022-06-20 Thread Sven Barth via fpc-pascal
Hairy Pixels schrieb am Mo., 20. Juni 2022, 03:38: > NOTE: I’m replying to this and CC’ing Sven so hopefully he can see it. > > > On Jun 19, 2022, at 10:05 AM, Hairy Pixels wrote: > > > > This code snippet will give a compiler error "Syntax error, ";" expected > but "(“ found”. It’s an unspecial

Re: [fpc-pascal] Are there any drawbacks to "reference to"?

2022-06-20 Thread Sven Barth via fpc-pascal
Hairy Pixels schrieb am Mo., 20. Juni 2022, 15:32: > Can anyone explain why this works? TProc is a normal function pointer so > how did it capture gVar? My understanding is that only nested proc vars > could do this. > Globals don't need to be captured, because they're reachable from any scope.

<    5   6   7   8   9   10   11   12   >