Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Sven Barth via fpc-devel
Am 26.04.2020 um 23:42 schrieb Benito van der Zander: Hi Sven, It's not that simple. In principle you're right that the compiler could try to merge more implementations, but this does not depend on the declaration of the generic, but the use of the parameter types. I mostly use generics fo

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Kai Burghardt
Hey folks! On Sun, Apr 26, 2020 at 03:09:43PM +0700, Ryan Joseph via fpc-devel wrote: > It was meant for a pretty narrow use of array types. [...] If so, can I finally have my Extended Pascal schemata? https://wiki.freepascal.org/Extended_Pascal#Schemata_.28not_yet_implemented.29 It's basically

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Marco van de Voort
Op 2020-04-26 om 11:48 schreef Sven Barth via fpc-devel: Jeppe had provided a potential usecase on the core mailing list in October '18. His example is not useable as-is, but to give you an idea:  As the compiler can inline all this, the writing of maintainable, hardware agnostic frameworks

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Benito van der Zander
Hi Sven, It's not that simple. In principle you're right that the compiler could try to merge more implementations, but this does not depend on the declaration of the generic, but the use of the parameter types. I mostly use generics for containers, especially hashmaps. They only stores th

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Marco van de Voort
Op 2020-04-26 om 11:02 schreef Michael Van Canneyt: As the original author, can you say something about the intended use of this feature ? It was meant for a pretty narrow use of array types. If I knew how much work it would be to implement I probably would have not done it. :P I personall

Re: [fpc-devel] Is there a less clumsy way to define a weak procedure?

2020-04-26 Thread Jonas Maebe
On 26/04/2020 20:48, Michael Ring via fpc-devel wrote: > I have to define a weak procedure in implementation of a unit to make > the linker happy in a special case: There is no support yet in the compiler to define weak symbols, only create weak references to (external) symbols. Jonas __

[fpc-devel] Is there a less clumsy way to define a weak procedure?

2020-04-26 Thread Michael Ring via fpc-devel
I have to define a weak procedure in implementation of a unit to make the linker happy in a special case: procedure vPortFree; external name 'vPortFree'; procedure vPortFreeStub; assembler; nostackframe; asm   .long vPortFree   .weak vPortFree   .set  vPortFree,vPortFreeStub   bkpt end; is the

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Ben Grasset via fpc-devel
On Sun, Apr 26, 2020 at 4:08 AM Anthony Walter via fpc-devel < fpc-devel@lists.freepascal.org> wrote: > Thank you Ryan and Sven. Your work is much appreciated as usual. > > However, Michael beat me to it in asking how this feature is useful. I am > sure there might be use cases, but for right now

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Ben Grasset via fpc-devel
On Sat, Apr 25, 2020 at 6:14 PM Sven Barth via fpc-devel < fpc-devel@lists.freepascal.org> wrote: > The Free Pascal team is happy to announce the addition of a new language > feature: constant parameters for generics. > YES! This is fantastic news. ___

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Sven Barth via fpc-devel
Am 26.04.2020 um 14:01 schrieb Benito van der Zander: Hi, perhaps it could be used to merge specializations (if fpc cannot do that on its own): Like when you have a hashmap THashMap, and need three specializations: THashMap THashMap THashMap It is basically three times the same hashmap,

Re: [fpc-devel] Windows Console App

2020-04-26 Thread Ozz Nixon via fpc-devel
Lol. That is not being done on purpose. To do it on purpose there are different ways depending upon your OS - windows I assume? keybd_event(Ord('A'), 0, KEYEVENTF_KEYDOWN, 0); keybd_event(Ord('A'), 0, KEYEVENTF_KEYUP, 0); * Common mistake is to call it once, it must be both for it to register. (

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Benito van der Zander
Hi, perhaps it could be used to merge specializations (if fpc cannot do that on its own): Like when you have a hashmap THashMap, and need three specializations: THashMap THashMap THashMap It is basically three times the same hashmap, but if fpc does not detect that, it might generate th

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Sven Barth via fpc-devel
Am 26.04.2020 um 09:38 schrieb Michael Van Canneyt: On Sun, 26 Apr 2020, Ryan Joseph via fpc-devel wrote: On Apr 26, 2020, at 5:13 AM, Sven Barth via fpc-devel wrote: The Free Pascal team is happy to announce the addition of a new language feature: constant parameters for generics. E

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Ryan Joseph via fpc-devel
> On Apr 26, 2020, at 4:02 PM, Michael Van Canneyt > wrote: > > Fixed-length arrays are the only practical use I can think of. I think you're right. Here's what I'll say next time: They're for composing types of dynamic size at compile time. :) Regards, Ryan Joseph

Re: [fpc-devel] Windows Console App

2020-04-26 Thread Gerhard Scholz
(laughter) I know how to write console apps; I even know how to start them :-) {I have no experience with GUI progarms, but that's another story :-( } No, my question was: how did you put the "D" in the keyboard buffer? I would like to put out the next command - Original Message - F

Re: [fpc-devel] Windows Console App

2020-04-26 Thread Ozz Nixon via fpc-devel
I will check your suggestions Alexander. Checked the code, it does if paramcount=0 then show help, then exit from main begin/end. It does not interact with the keyboard unless instructed to (its a pascal script engine). On Sun, Apr 26, 2020 at 3:28 AM Alexander Grotewohl wrote: > you're not usi

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Florian Klaempfl
Am 26.04.2020 um 11:02 schrieb Michael Van Canneyt: On Sun, 26 Apr 2020, Ryan Joseph via fpc-devel wrote: On Apr 26, 2020, at 2:38 PM, Michael Van Canneyt wrote: As the original author, can you say something about the intended use of this feature ? It was meant for a pretty narrow us

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Michael Van Canneyt
On Sun, 26 Apr 2020, Ryan Joseph via fpc-devel wrote: On Apr 26, 2020, at 2:38 PM, Michael Van Canneyt wrote: As the original author, can you say something about the intended use of this feature ? It was meant for a pretty narrow use of array types. If I knew how much work it would be

Re: [fpc-devel] Windows Console App

2020-04-26 Thread Alexander Grotewohl
you're not using the crt unit are you? first because i think it doesn't support utf8 and second because i think you can cause this by doing "if keypressed.." without then doing readkey before exit. -- Alexander Grotewohl https://dcclost.com From: fpc-devel on be

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread gabor
W dniu 2020-04-26 o 09:38, Michael Van Canneyt pisze: Sven gave some examples, and they show how it works, but from his examples I don't see the point of this feature. Michael. It can be quite useful. You can do something similar (I hope): https://sourceforge.net/p/ultravnc/code/HEAD/tree/Ult

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Ryan Joseph via fpc-devel
> On Apr 26, 2020, at 2:38 PM, Michael Van Canneyt > wrote: > > As the original author, can you say something about the intended use of this > feature ? It was meant for a pretty narrow use of array types. If I knew how much work it would be to implement I probably would have not done it. :

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Anthony Walter via fpc-devel
Thank you Ryan and Sven. Your work is much appreciated as usual. However, Michael beat me to it in asking how this feature is useful. I am sure there might be use cases, but for right now I am coming up without any real advantages. Could anyone with better insight than me please explain? _

Re: [fpc-devel] New feature announcement: constant parameters for generics

2020-04-26 Thread Michael Van Canneyt
On Sun, 26 Apr 2020, Ryan Joseph via fpc-devel wrote: On Apr 26, 2020, at 5:13 AM, Sven Barth via fpc-devel wrote: The Free Pascal team is happy to announce the addition of a new language feature: constant parameters for generics. Excellent! Thanks for getting this merged. It was a lo