Re: [fpc-pascal] Unrelated type helpers with the same members? Implement an interface with a type helper?

2022-12-23 Thread Sven Barth via fpc-pascal
Michael Van Canneyt via fpc-pascal schrieb am Fr., 23. Dez. 2022, 10:48: > > > On Fri, 23 Dec 2022, Sven Barth via fpc-pascal wrote: > > > Michael Van Canneyt via fpc-pascal > > schrieb am Fr., 23. Dez. 2022, 08:18: > > > >> > >> > >>

Re: [fpc-pascal] Unrelated type helpers with the same members? Implement an interface with a type helper?

2022-12-23 Thread Sven Barth via fpc-pascal
Michael Van Canneyt via fpc-pascal schrieb am Fr., 23. Dez. 2022, 08:18: > > > On Thu, 22 Dec 2022, Andrew Haines via fpc-pascal wrote: > > > Hi what I want to do is similar to this question here: > > > https://en.delphipraxis.net/topic/423-rtti-determine-record-helper-type-for-a-base-type/ > > >

Re: [fpc-pascal] How to inline CompareFunc to Sort method in generic abstract class

2022-11-20 Thread Sven Barth via fpc-pascal
Am 20.11.2022 um 02:02 schrieb Hairy Pixels: On Nov 20, 2022, at 4:26 AM, Sven Barth via fpc-pascal wrote: // this kind of constraint that uses T does not work yet generic TList> = class procedure Sort; end; Does this mean the generic param “Comparer” has a constraint which

Re: [fpc-pascal] How to inline CompareFunc to Sort method in generic abstract class

2022-11-19 Thread Sven Barth via fpc-pascal
Am 14.11.2022 um 19:26 schrieb Vojtěch Čihák via fpc-pascal: Hi, I wrote a generic abstract class - a list based on dynamic array (i.e. array of T;) and this class can be specialized elsewhere with any type (records or classes). Part of the class is sorting. There are more ways how to deliver

Re: [fpc-pascal] How to inline CompareFunc to Sort method in generic abstract class

2022-11-19 Thread Sven Barth via fpc-pascal
Am 18.11.2022 um 20:44 schrieb Flávio Etrusco via fpc-pascal: Em seg., 14 de nov. de 2022 15:26, Vojtěch Čihák via fpc-pascal escreveu: Hi, I wrote a generic abstract class - a list based on dynamic array (i.e. array of T;) and this class can be specialized elsewhere with a

Re: [fpc-pascal] Program efficiency

2022-11-09 Thread Sven Barth via fpc-pascal
James Richters via fpc-pascal schrieb am Mi., 9. Nov. 2022, 13:47: > In other words.. is > > A:=(B+C/D)-E^F; > G:=H*(I+J); > K:=L+M/N; > O:= A+G-K; > > Less efficient than > O:= ((B+C/D)-E^F)+ (H*(I+J))-(L+M/N); > > Or does it end up being the same when it's done? > The compiler will insert temp

Re: [fpc-pascal] [Question] How to submit our patch?

2022-10-10 Thread Sven Barth via fpc-pascal
Jinyang He via fpc-pascal schrieb am Mo., 10. Okt. 2022, 11:47: > We, a team working for Loongson, are ready to submit some patches which > support a new architecture named LoongArch for FreePascal. [1] is one of > repositories about LoongArch. LoongArch is a RISC architecture. The work > of Loon

Re: [fpc-pascal] [Question] How to submit our patch?

2022-10-10 Thread Sven Barth via fpc-pascal
Christo Crause via fpc-pascal schrieb am Mo., 10. Okt. 2022, 17:20: > > On Mon, Oct 10, 2022 at 11:47 AM Jinyang He via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > >> We, a team working for Loongson, are ready to submit some patches which >> support a new architecture named LoongArch

Re: [fpc-pascal] Variants with classes and records

2022-10-06 Thread Sven Barth via fpc-pascal
Hairy Pixels schrieb am Do., 6. Okt. 2022, 13:49: > > > > On Oct 6, 2022, at 12:45 PM, Sven Barth > wrote: > > > > Am 05.10.2022 um 14:16 schrieb Hairy Pixels via fpc-pascal: > >> Is it possible to assign a class to a variant? I tried and get a crash. > If

Re: [fpc-pascal] Variants with classes and records

2022-10-05 Thread Sven Barth via fpc-pascal
Am 05.10.2022 um 14:16 schrieb Hairy Pixels via fpc-pascal: Is it possible to assign a class to a variant? I tried and get a crash. If not, why not? It’s just a pointer so I would expect it to work. There is no field that would hold a class reference and no type value that would differentiate

Re: [fpc-pascal] TJSONParser crash

2022-09-28 Thread Sven Barth via fpc-pascal
Hairy Pixels via fpc-pascal schrieb am Mi., 28. Sep. 2022, 16:17: > Ok I narrowed down this bug I get with 3.2.2 to TJSONParser. > > I’m so confused as to what changed. FormatJSON prints the JSON as > expected but AsString crashes and gives the error I was seeing from the RPC > which it trapped

Re: [fpc-pascal] mciSendString with long file names

2022-09-22 Thread Sven Barth via fpc-pascal
Dennis Lee Bieber via fpc-pascal schrieb am Fr., 23. Sep. 2022, 04:10: >If FP is attempting to translate \ into some escape code, you > might try doubling the backslashes... C:\\Program Files\\My Program\\... > (I'm presuming "Progam" is a typo. > FPC has no need for that as "\" isn't us

Re: [fpc-pascal] Get TMethod from function reference

2022-09-19 Thread Sven Barth via fpc-pascal
Hairy Pixels schrieb am So., 18. Sep. 2022, 02:50: > > > > On Sep 17, 2022, at 10:57 PM, Sven Barth > wrote: > > > > === code begin === > > > > type > > TProc = reference to procedure; > > TMyClass = class > > procedure DoThis;

Re: [fpc-pascal] $modeswitch declared before $mode fails without warning

2022-09-18 Thread Sven Barth via fpc-pascal
Am 18.09.2022 um 15:39 schrieb Hairy Pixels via fpc-pascal: On Sep 18, 2022, at 7:37 PM, Florian Klämpfl via fpc-pascal wrote: This is in general the case that $mode overrides all previously set switches i.e. it simply sets the switches as defined by the given mode so I am not sure if this

Re: [fpc-pascal] Get TMethod from function reference

2022-09-17 Thread Sven Barth via fpc-pascal
Am 16.09.2022 um 03:53 schrieb Hairy Pixels: On Sep 11, 2022, at 3:28 PM, Ondrej Pokorny via fpc-pascal wrote: You should be able to get the Invoke procedure pointer from the RTTI. Sorry Sven mentioned this I must have glossed over it. So yes I am storing the function reference in a class

Re: [fpc-pascal] Function reference doesn't capture in thread

2022-09-17 Thread Sven Barth via fpc-pascal
Am 17.09.2022 um 17:04 schrieb Hairy Pixels: On Sep 17, 2022, at 9:43 PM, Sven Barth wrote: Then you didn't read my announcement mail deeply enough, cause it's mentioned there! Yes I just read that over and I remember it now. I feel like this not the same behavior in other

Re: [fpc-pascal] Function reference doesn't capture in thread

2022-09-17 Thread Sven Barth via fpc-pascal
Hairy Pixels schrieb am Sa., 17. Sep. 2022, 16:38: > > > > On Sep 17, 2022, at 7:40 PM, Sven Barth > wrote: > > > > It seems you haven't read the part about capturing variables in my > announcement mail, cause you have two problems: > > First the spec

Re: [fpc-pascal] Function reference doesn't capture in thread

2022-09-17 Thread Sven Barth via fpc-pascal
Am 17.09.2022 um 07:02 schrieb Hairy Pixels via fpc-pascal: Can anyone explain why this program doesn’t capture the state of the local variable “I” and execute in order? It will return something like this: Invoked: 3 id: 0001029D41C0 Invoked: 0 id: 0001029D42C0 Invoked: 0 id: 000102

Re: [fpc-pascal] Get TMethod from function reference

2022-09-15 Thread Sven Barth via fpc-pascal
Am 15.09.2022 um 15:30 schrieb Hairy Pixels: On Sep 15, 2022, at 12:28 PM, Sven Barth wrote: As mentioned elsewhere function references are in fact interfaces. And you can't retrieve a method pointer to a interface function, cause relying on that would result in either memory lea

Re: [fpc-pascal] Get TMethod from function reference

2022-09-14 Thread Sven Barth via fpc-pascal
Am 08.09.2022 um 16:55 schrieb Hairy Pixels via fpc-pascal: A function reference can call a class method but can you get the TMethod data from function references? It was possible with “is object” to cast to TMethod but that doesn’t seem to be possible with references. = type TMyCl

Re: [fpc-pascal] Access Violation When SetLength(DynArray, Value)

2022-09-14 Thread Sven Barth via fpc-pascal
Am 10.09.2022 um 01:41 schrieb James Richters: I thought I would make my own IncArray() function: Procedure IncArray(Var TheArray); Begin SetLength(TheArray,Length(TheArray)+1); End; But I get a 'Type Mismatch' Any ideas how this could be done? Is this even possible without specifying the

Re: [fpc-pascal] Why does nested function get corrupted?

2022-09-11 Thread Sven Barth via fpc-pascal
Ondrej Pokorny via fpc-pascal schrieb am So., 11. Sep. 2022, 15:29: > Am 11.09.2022 um 14:22 schrieb Sven Barth via fpc-pascal: > > Ondrej Pokorny via fpc-pascal schrieb > am So., 11. Sep. 2022, 12:18: > >> Shouldn't this assignment be forbidden? >> >>

Re: [fpc-pascal] Why does nested function get corrupted?

2022-09-11 Thread Sven Barth via fpc-pascal
Ondrej Pokorny via fpc-pascal schrieb am So., 11. Sep. 2022, 12:18: > Am 11.09.2022 um 11:26 schrieb Sven Barth via fpc-pascal: > > Hairy Pixels schrieb am Sa., 10. Sep. 2022, 03:21: > >> >> >> > On Sep 9, 2022, at 4:48 PM, Sven Barth >> wrote: >

Re: [fpc-pascal] Get highest element of a StringList

2022-09-11 Thread Sven Barth via fpc-pascal
James Richters via fpc-pascal schrieb am Sa., 10. Sep. 2022, 22:55: > > For some reason > {$Mode FPC} > {$modeswitch typehelpers} > Still had Error: Identifier not found "class" > Because support for the "class" keyword is only available when the modeswitch Class is enabled which is the case for

Re: [fpc-pascal] Why does nested function get corrupted?

2022-09-11 Thread Sven Barth via fpc-pascal
Hairy Pixels schrieb am Sa., 10. Sep. 2022, 03:21: > > > > On Sep 9, 2022, at 4:48 PM, Sven Barth > wrote: > > > > How about you simply report such corruptions as bugs? I can always close > them as "not a bug" or duplicate if necessary. > > > >

Re: [fpc-pascal] Internal error 2019022201 from function reference

2022-09-11 Thread Sven Barth via fpc-pascal
Hairy Pixels via fpc-pascal schrieb am Fr., 9. Sep. 2022, 18:05: > This program gives internal compiler error 2019022201 (Free Pascal > Compiler version 3.3.1 [2022/05/27] for aarch64). Something is wrong with > the PPU. This is a very basic program using function references so it > seems unlike

Re: [fpc-pascal] Access Violation When SetLength(DynArray, Value)

2022-09-09 Thread Sven Barth via fpc-pascal
Luca Olivetti via fpc-pascal schrieb am Fr., 9. Sep. 2022, 15:29: > I don't know if it is more or less efficient than using a dynamic array > but I think it's nicer. > It internally uses a dynamic array as well, but duplicates the size with each growth and keeps track of a separate count of elem

Re: [fpc-pascal] Access Violation When SetLength(DynArray, Value)

2022-09-09 Thread Sven Barth via fpc-pascal
James Richters via fpc-pascal schrieb am Fr., 9. Sep. 2022, 14:58: > I still end up with a lot of > SetLength(MyArray,Length(MyArray)+1); > Every time I want to add one more thing to the array. > With FPC 3.2.0 and newer you can do "Concat(MyArray, [TheNewElement])" or (if modeswitch ArrayOperat

Re: [fpc-pascal] Why does nested function get corrupted?

2022-09-09 Thread Sven Barth via fpc-pascal
Hairy Pixels via fpc-pascal schrieb am Fr., 9. Sep. 2022, 00:52: > Curious more than anything, if is nested captures state in a record and > passes it as an hidden self param, why does returning the variable and > calling from outside the calling stack frame corrupt the data? It seems > like it t

Re: [fpc-pascal] reading a TFPGMap from several threads

2022-09-07 Thread Sven Barth via fpc-pascal
Luca Olivetti via fpc-pascal schrieb am Mi., 7. Sep. 2022, 13:01: > Hello, > > I have a couple of TFPGMaps that I populate once and never change. > Is it safe to read them (i.e. use Find and Data[]) from different threads? > I'd avoid using a critical section if not absolutely necessary. > I'd s

Re: [fpc-pascal] Arguments gets corrupted with anonymous nested function

2022-09-07 Thread Sven Barth via fpc-pascal
Peter B via fpc-pascal schrieb am Mi., 7. Sep. 2022, 13:58: > I'm wondering if this is related to > https://gitlab.com/freepascal.org/fpc/source/-/issues/38703 > > That caused a parameter corruption in a standard function. > https://lists.freepascal.org/pipermail/fpc-pascal/2022-March/060361.html

Re: [fpc-pascal] Arguments gets corrupted with anonymous nested function

2022-09-05 Thread Sven Barth via fpc-pascal
Am 04.09.2022 um 22:05 schrieb Hairy Pixels: On Sep 4, 2022, at 1:36 PM, Sven Barth wrote: Does this also happen if you don't use a class? Otherwise it might be related with the other error you already reported. But report this anyway, I'll simply mark it as duplicate if necess

Re: [fpc-pascal] Arguments gets corrupted with anonymous nested function

2022-09-04 Thread Sven Barth via fpc-pascal
Hairy Pixels via fpc-pascal schrieb am So., 4. Sep. 2022, 18:07: > The following program uses an anonymous nested function which captures a > local variable. It seems the arguments get corrupted (likely because of the > hidden first param for the nested function signature) and prints garbled > da

Re: [fpc-pascal] BoolToStr

2022-08-28 Thread Sven Barth via fpc-pascal
Am 29.08.2022 um 01:41 schrieb James Richters via fpc-pascal: I'm curious if there is a way to search the FPC version history of changes for BoolToStr to see why it was changed, and see if there is a valid reason not to change it back. it was obviously changed from the way the documentations is

Re: [fpc-pascal] Class or Record Helper for Interface?

2022-08-27 Thread Sven Barth via fpc-pascal
Anthony Walter schrieb am Sa., 27. Aug. 2022, 22:45: > I'd be all for just eliminating the "class", "record", and "type" helper > and adding support for just using "helper" in all modes. > "type helper" already allows you to use any supported type. There won't be any further changes regarding

Re: [fpc-pascal] Class or Record Helper for Interface?

2022-08-27 Thread Sven Barth via fpc-pascal
Anthony Walter via fpc-pascal schrieb am Sa., 27. Aug. 2022, 15:07: > Ah, it seems the problem is even in {$mode delphi} you must use > {$modeswitch typehelpers} to define a type helper for an interface. > Delphi doesn't support interface helpers, so I don't know whether they'd use "class helper

Re: [fpc-pascal] Bug or feature ?

2022-07-27 Thread Sven Barth via fpc-pascal
Am 27.07.2022 um 15:14 schrieb Ched via fpc-pascal: Hello All, I have a long code which include lines for writing stuffs into an assigned writable text-file F.    WRITELN(F: 'Hello');    WRITELN(F, 'Hello'); The code can be compiled with 3.2.2 in i386/windows and i386/linux and runs both t

Re: [fpc-pascal] Fwd: Re: Cross-compiler for ARM64 on Windows available?

2022-06-25 Thread Sven Barth via fpc-pascal
Tomas Hajny via fpc-pascal schrieb am Sa., 25. Juni 2022, 15:07: > Sorry, one additional thought - it's better to choose a directory > without spaces when installing the LLVM package (i.e. not to accept the > default proposal "C:\Program Files\..."), or at least let the installer > change the PAT

Re: [fpc-pascal] Cross-compiler for ARM64 on Windows available?

2022-06-25 Thread Sven Barth via fpc-pascal
Wolfgang Hubert via fpc-pascal schrieb am Sa., 25. Juni 2022, 11:03: > Hi Tomas, > > Tomas Hajny wrote: > > if you already have your FPC 3.2.2 installation, plus installation of an > > external package (LLVM). All of it rather feasible. Yes, you may > possibly > > encounter some issues with the c

Re: [fpc-pascal] Operator not overloaded

2022-06-24 Thread Sven Barth via fpc-pascal
Thomas Kurz via fpc-pascal schrieb am Fr., 24. Juni 2022, 15:33: > Thank you very much, declaring the operator within the record does indeed > solve the issue. > > Just to be sure in case I might need it some day: Does this mean, if I > need e.g. a comparison operator for a specialized TPair, I w

Re: [fpc-pascal] Cross-compiler for ARM64 on Windows available?

2022-06-24 Thread Sven Barth via fpc-pascal
Travis Siegel via fpc-pascal schrieb am Do., 23. Juni 2022, 20:08: > There actually is a 64-bit version of xp, but it's not compatible with > very much. Apparently, it didn't have an emulator in it, so running > 32-bit software wasn't something it did by default. I never did figure > out if it

Re: [fpc-pascal] Operator not overloaded

2022-06-24 Thread Sven Barth via fpc-pascal
Thomas Kurz via fpc-pascal schrieb am Do., 23. Juni 2022, 19:45: > When compiling, I get this error: > > pathfinding.pas(17,17) Error: Operator is not overloaded: "TTileSegment" = > "TTileSegment" > > Which I don't understand -- because the "=" operator is defined in > tesstypes.pas. > > Am I doi

Re: [fpc-pascal] Cross-compiler for ARM64 on Windows available?

2022-06-22 Thread Sven Barth via fpc-pascal
Tomas Hajny schrieb am Mi., 22. Juni 2022, 10:57: > On 2022-06-21 20:01, Sven Barth wrote: > > Tomas Hajny via fpc-pascal schrieb > > am Di., 21. Juni 2022, 18:08: > > > Hi Sven, > > . > . > >> I just tried to follow the advice above. Compiling the

Re: [fpc-pascal] Cross-compiler for ARM64 on Windows available?

2022-06-21 Thread Sven Barth via fpc-pascal
Tomas Hajny via fpc-pascal schrieb am Di., 21. Juni 2022, 18:08: > On 2022-06-21 00:14, Pierre Muller via fpc-pascal wrote: > > Le 20/06/2022 à 23:53, Sven Barth via fpc-pascal a écrit : > >> Am 20.06.2022 um 12:34 schrieb Wolfgang Hubert via fpc-pascal: > >

[fpc-pascal] Mail Test

2022-06-21 Thread Sven Barth via fpc-pascal
This is just a test of the mailing list. @Ryan: if you can see this, would you please reply with only the list, but not myself as receiver? Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/ma

Re: [fpc-pascal] Cross-compiler for ARM64 on Windows available?

2022-06-20 Thread Sven Barth via fpc-pascal
Am 20.06.2022 um 12:34 schrieb Wolfgang Hubert via fpc-pascal: Hi, I have developed a DLL for x64 Windows and compiled with fpc 3.2.2. I would like to compile the same code for ARM64 running Windows. I need this to support the MS Surface devices. Even though the platform list of the Laza

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, 15:12: > > > > On Jun 20, 2022, at 7:12 PM, Sven Barth > wrote: > > > > Please report a bug. > > > > Done. https://gitlab.com/freepascal.org/fpc/source/-/issues/39794. I may > actually try to fix this m

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

2022-06-20 Thread Sven Barth via fpc-pascal
Michael Van Canneyt via fpc-pascal schrieb am Mo., 20. Juni 2022, 15:41: > > > On Mon, 20 Jun 2022, Sven Barth wrote: > > > Michael Van Canneyt schrieb am Mo., 20. Juni > 2022, > > 08:04: > > > >> > >> > >> On Mon, 20 Jun 2022, Sven B

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:30: > > > > On Jun 20, 2022, at 12:44 PM, Sven Barth > wrote: > > > > If the compiler can proove that the function reference never leaves the > scope (that means no assignment to global variables, out/var parameters,

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.

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
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] 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 var

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

[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] 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. 

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

[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] 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

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

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