Re: [fpc-pascal] Constants in generics

2019-01-06 Thread Sven Barth via fpc-pascal
Am Sa., 5. Jan. 2019, 22:57 hat Ryan Joseph geschrieben: > Here’s the new syntax requirements for const params which require types > and consts be separated by semicolons. > > Does TStuff2 need a ; between the two const params? Sven said consts must > follow ; or < but they’re both consts so I th

Re: [fpc-pascal] Get "disk" ID

2019-01-06 Thread Giuliano Colla
Il 05/01/2019 17:03, Bart ha scritto: I need some function to get a unique ID for a disk. I need this to identify if my program has accessed this disk previously. For that purpose on Linux, out of laziness, I usually just parse the output of command-line utilities, such as blkid or lsblk. bl

[fpc-pascal] Interface bug or some new feature

2019-01-06 Thread denisgolovan
Hi all I've been using 3.1.1 compiler for a long time and now I am trying to upgrade to 3.3.1 from trunk. However, I am stuck with some new behavior when using classes + interfaces. I've managed to reproduce it in a small example which follows. Specifically 3.1.1 compiler compiles it and correc

Re: [fpc-pascal] Get "disk" ID

2019-01-06 Thread Sven Barth via fpc-pascal
Am Sa., 5. Jan. 2019, 17:05 hat Bart geschrieben: > Hi, > > I need some function to get a unique ID for a disk. > I need this to identify if my program has accessed this disk previously. > > On Windows I can retreive the VolumeSerialNr, but how do I do > something like that in Linux? > Mind you:

Re: [fpc-pascal] Interface bug or some new feature

2019-01-06 Thread Jonas Maebe
On 06/01/19 11:42, denisgolovan wrote: Specifically 3.1.1 compiler compiles it and correctly prints "Double". 3.3.1 compiler refuses to compile it at all. Please comment if it's a bug or a new breaking feature. http://wiki.freepascal.org/User_Changes_Trunk#Methods_implementing_interface_method

Re: [fpc-pascal] Interface bug or some new feature

2019-01-06 Thread Sven Barth via fpc-pascal
Am So., 6. Jan. 2019, 11:42 hat denisgolovan geschrieben: > Hi all > > I've been using 3.1.1 compiler for a long time and now I am trying to > upgrade to 3.3.1 from trunk. > However, I am stuck with some new behavior when using classes + interfaces. > I've managed to reproduce it in a small examp

Re: [fpc-pascal] Interface bug or some new feature

2019-01-06 Thread denisgolovan
06.01.2019, 14:57, "Jonas Maebe" : > http://wiki.freepascal.org/User_Changes_Trunk#Methods_implementing_interface_methods_and_overloads > > Jonas Thanks, Jonas. That was precisely the cause for my trouble. -- Regards, Denis Golovan ___ fpc-pascal ma

Re: [fpc-pascal] Interface bug or some new feature

2019-01-06 Thread denisgolovan
  06.01.2019, 15:00, "Sven Barth via fpc-pascal" : The default visibility for classes without $M+ is private. Thus TClass1.P is private. An interface implementation does not have access to private methods of a parent class. So you need to declare P as protected for this to work. Though to be fair i

Re: [fpc-pascal] Interface bug or some new feature

2019-01-06 Thread Sven Barth via fpc-pascal
Am 06.01.2019 um 13:30 schrieb denisgolovan: 06.01.2019, 15:00, "Sven Barth via fpc-pascal" : The default visibility for classes without $M+ is private. Thus TClass1.P is private. An interface implementation does not have access to private methods of a parent class. So you need to declare P as

Re: [fpc-pascal] Interface bug or some new feature

2019-01-06 Thread Sven Barth via fpc-pascal
Am 06.01.2019 um 12:56 schrieb Jonas Maebe: On 06/01/19 11:42, denisgolovan wrote: Specifically 3.1.1 compiler compiles it and correctly prints "Double". 3.3.1 compiler refuses to compile it at all. Please comment if it's a bug or a new breaking feature. http://wiki.freepascal.org/User_Change

Re: [fpc-pascal] Interface bug or some new feature

2019-01-06 Thread Jonas Maebe
On 06/01/19 14:00, Sven Barth via fpc-pascal wrote: Am 06.01.2019 um 12:56 schrieb Jonas Maebe: On 06/01/19 11:42, denisgolovan wrote: Specifically 3.1.1 compiler compiles it and correctly prints "Double". 3.3.1 compiler refuses to compile it at all. Please comment if it's a bug or a new break

Re: [fpc-pascal] Constants in generics

2019-01-06 Thread Ryan Joseph
> On Jan 6, 2019, at 1:28 AM, Sven Barth via fpc-pascal > wrote: > > Just think about it logically: B and C can't be anything else than const, so > why would we need to repeat it? I’m not saying anyone would actually write that generic but if it does appear what terminator is used? A more

Re: [fpc-pascal] Constants in generics

2019-01-06 Thread Ryan Joseph
Last question I have I think. Is this the best way to get "pretty name" string for a set? Having to loop through the entire range of the set is not so great but I don’t see another way. I feel like there should be some utility functions to get names for ord defs also but I just did a crude str

Re: [fpc-pascal] Constants in generics

2019-01-06 Thread Ben Grasset
Just wanted to say, I've been playing around with Ryan's github branch that contains this functionality and I'm loving it! It really opens up a ton of interesting possibilities in general, and also a lot of potential for optimization via constant folding for generic containers that wasn't really po

Re: [fpc-pascal] Constants in generics

2019-01-06 Thread Ryan Joseph
> On Jan 6, 2019, at 1:31 PM, Ben Grasset wrote: > > generic TStaticList = record > This is exactly the reason I added the feature, there’s no way to extend static arrays otherwise! Beyond this one thing I have no idea what to use them for. ;) Regards, Ryan Joseph ___

Re: [fpc-pascal] Constants in generics

2019-01-06 Thread Ben Grasset
On Sun, Jan 6, 2019 at 4:23 PM Ryan Joseph wrote: > This is exactly the reason I added the feature, there’s no way to extend > static arrays otherwise! Beyond this one thing I have no idea what to use > them for. ;) > I've got a bunch of stuff in mind actually that I'm waiting on the "final" ver

Re: [fpc-pascal] Constants in generics

2019-01-06 Thread Ryan Joseph
Since we introduced “const” keywords to generic params does it make sense to use an optional “type” keyword also? That just occurred to me as something worth discussing. No opinion either way except there’s a inconsistency now which may bother some people. generic TStuff = record end; Regards,

Re: [fpc-pascal] inlining functions

2019-01-06 Thread Jonas Maebe
On 03/01/19 00:10, Benito van der Zander wrote: The one-pass thing is probably the reason it now complains about all inline functions in dependency cycles, unit A uses unit B that uses unit A. Then unit A can't inline something unit B. Any way around that? Not besides breaking your dependency

Re: [fpc-pascal] Constants in generics

2019-01-06 Thread Sven Barth via fpc-pascal
Am So., 6. Jan. 2019, 19:07 hat Ryan Joseph geschrieben: > Last question I have I think. > > Is this the best way to get "pretty name" string for a set? Having to loop > through the entire range of the set is not so great but I don’t see another > way. I feel like there should be some utility fun

Re: [fpc-pascal] Constants in generics

2019-01-06 Thread Sven Barth via fpc-pascal
Am So., 6. Jan. 2019, 22:38 hat Ryan Joseph geschrieben: > Since we introduced “const” keywords to generic params does it make sense > to use an optional “type” keyword also? That just occurred to me as > something worth discussing. No opinion either way except there’s a > inconsistency now which

Re: [fpc-pascal] Constants in generics

2019-01-06 Thread Ryan Joseph
I updated the github with the requested changes. Is that everything? I’ll submit a patch if so. https://github.com/genericptr/freepascal/tree/generic_constants Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org ht

Re: [fpc-pascal] Constants in generics

2019-01-06 Thread Ben Grasset
You still have two C-style operator += instances in pgenutil.pas FYI, that don't compile with the default settings. On Sun, Jan 6, 2019 at 8:36 PM Ryan Joseph wrote: > I updated the github with the requested changes. Is that everything? I’ll > submit a patch if so. > > https://github.com/generic

Re: [fpc-pascal] Constants in generics

2019-01-06 Thread Ben Grasset
Also, there's: pgenutil.pas(158,28) Warning: Class types "tenumdef" and "torddef" are not related which breaks compilation because the compiler is built with -sew turned on if you do it through the normal makefiles. I think you need tests before you do a patch, also? (Unless you already have them

[fpc-pascal] Small typo in User_Changes_Trunk ?

2019-01-06 Thread LacaK
Hi, reading http://wiki.freepascal.org/User_Changes_Trunk#Modeswitch_TypeHelpers_in_Delphi_modes_enables_type_helper-syntax there is: Remedy: The only problems arise if one disabled the modeswitch on purpose which now longer disallows the extension of primitive types. Is there missing "no"?: Re