Re: [fpc-pascal] GetLocaleInfo returns ZZZ

2018-02-21 Thread Michael Van Canneyt
On Thu, 22 Feb 2018, Darius Blaszyk wrote: On my machine getlocaleinfo returns ZZZ when requesting the abbrev langname. The country code is correctly set to NL. This makes gettext.GetLanguageIDs return zz_NL. What could be causing this? Also the behavior of GetLocaleInfoIDs does not seem

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread russeld
Pascal allows type declarations at the procedure level, so you could use type aliases to reduce your typing and still have code completion: procedure foo(); type SVK = NSSomeLongNameOfSomethingValueKey; var a: SVK; begin a := SVK.some_key_value; end; If you tried to use SVK elsewhere an

Re: [fpc-pascal] fpreport rangeerrors with TFPReportColor

2018-02-21 Thread Michael Van Canneyt
On Thu, 22 Feb 2018, Andreas Frieß wrote: Another possible Problem with the definition TFPColor (fpc)  record with word <> TColor (lazarus) -$7FFF-1..$7FFF <> TFPReportColor (fpreport) UInt32 So you cannot use in Lazarus the 'well known' TColors. With TColor it is also Delphi

[fpc-pascal] GetLocaleInfo returns ZZZ

2018-02-21 Thread Darius Blaszyk
On my machine getlocaleinfo returns ZZZ when requesting the abbrev langname. The country code is correctly set to NL. This makes gettext.GetLanguageIDs return zz_NL. What could be causing this? Also the behavior of GetLocaleInfoIDs does not seem to be according to the gettext manual. On

Re: [fpc-pascal] fpreport rangeerrors with TFPReportColor

2018-02-21 Thread Andreas Frieß
Another possible Problem with the definition TFPColor (fpc)  record with word <> TColor (lazarus) -$7FFF-1..$7FFF <> TFPReportColor (fpreport) UInt32 So you cannot use in Lazarus the 'well known' TColors. With TColor it is also Delphi compatible. If the defines are Lazarus

Re: [fpc-pascal] fpreport rangeerrors with TFPReportColor

2018-02-21 Thread Michael Van Canneyt
On Wed, 21 Feb 2018, Mattias Gaertner wrote: On Wed, 21 Feb 2018 19:54:55 + Graeme Geldenhuys wrote: [...] > Because UInt32 is not a JSON dataformat. Well, then I'll say that FPC's JSON needs to be extended to support UInt32, as it is a perfectly valid

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Benito van der Zander
Hi Fpc-pascal Users, I simply rely on my IDE (Lazarus, Visual Studio)  to complete long identifier names for me so that I don't have to. *shrugs*  but you still need to read the identifiers and when they are too long, that takes time, too How does that look? No idea how it looked, but

Re: [fpc-pascal] fpreport rangeerrors with TFPReportColor

2018-02-21 Thread Mattias Gaertner
On Wed, 21 Feb 2018 19:54:55 + Graeme Geldenhuys wrote: >[...] > > Because UInt32 is not a JSON dataformat. > > Well, then I'll say that FPC's JSON needs to be extended to support > UInt32, as it is a perfectly valid Object Pascal data type. How should

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Marco van de Voort
In our previous episode, Ryan Joseph said: > > Having to decide a variable is scoped or not when it is declared is not the > > most ideal solution anyway. Logically you would decide that when creating > > the scope, iow when importing, like in Modula2 or (afaik also) Extended > > Pascal. > > How

Re: [fpc-pascal] fpreport rangeerrors with TFPReportColor

2018-02-21 Thread Graeme Geldenhuys
On 2018-02-21 08:48, Andreas Frieß wrote: The definition is TFPReportColor  = type UInt32; That was designed and defined to handle AARRGGBB values of $ (max 256 for each color channel and alpha), and that fits perfectly in a UInt32 data type. Should the definition for

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Bernd Oppolzer
Am 21.02.2018 um 16:29 schrieb Ryan Joseph: On Feb 21, 2018, at 10:13 PM, Michael Van Canneyt wrote: You lose an important type safety if you replace them with constants. I like enums also but you can imagine when they were proposed the compiler teams probably

Re: [fpc-pascal] GetLocaleInfo returns ZZZ

2018-02-21 Thread Bart
On Wed, Feb 21, 2018 at 12:11 PM, Darius Blaszyk wrote: > On my machine getlocaleinfo returns ZZZ when requesting the abbrev langname. > The country code is correctly set to NL. This makes gettext.GetLanguageIDs > return zz_NL. What could be causing this? Maybe the same

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Ryan Joseph
> On Feb 21, 2018, at 10:13 PM, Michael Van Canneyt > wrote: > > You lose an important type safety if you replace them with constants. I like enums also but you can imagine when they were proposed the compiler teams probably compared them to constants and decided if

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Ryan Joseph
> On Feb 21, 2018, at 10:18 PM, Marco van de Voort wrote: > > Having to decide a variable is scoped or not when it is declared is not the > most ideal solution anyway. Logically you would decide that when creating > the scope, iow when importing, like in Modula2 or (afaik

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Marco van de Voort
In our previous episode, Ryan Joseph said: > Adding compiler features is a slippery slope and I have no idea where to > draw lines. Scoped enums aren?t necessary and in fact enums in general > could be replaced with constants easily enough so that feature was > probably debated at some point

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Michael Van Canneyt
On Wed, 21 Feb 2018, Ryan Joseph wrote: On Feb 21, 2018, at 5:16 PM, Sven Barth via fpc-pascal wrote: I simply rely on my IDE (Lazarus, Visual Studio) to complete long identifier names for me so that I don't have to. *shrugs* Sure enough it’s not a

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Ryan Joseph
> On Feb 21, 2018, at 5:16 PM, Sven Barth via fpc-pascal > wrote: > > I simply rely on my IDE (Lazarus, Visual Studio) to complete long identifier > names for me so that I don't have to. *shrugs* Sure enough it’s not a pressing matter by any means but I

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Martok
Am 21.02.2018 um 10:45 schrieb Michael Van Canneyt: > I was waiting for this reply from you. You didn't disappoint ;) Got an image to maintain ;-) Took me long enough to come up with that actually fairly simple workaround, might as well save others the trouble. That stuff is like "bad keming", I

Re: [fpc-pascal] fpreport rangeerrors with TFPReportColor

2018-02-21 Thread Andreas Frieß
Andreas Frieß wrote: > when i compile in Lazarus the Reportdesigner with activated > RangeCheck it gives a lot of runtimeerror with rangeerrors. > For explanation what i mean in my previous post, UInt32 is not an integer or JSON compatible size (and actual rangecheck unsafe). ANdreas

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread wkitty42
On 02/21/2018 05:16 AM, Sven Barth via fpc-pascal wrote: I simply rely on my IDE (Lazarus, Visual Studio) to complete long identifier names for me so that I don't have to. *shrugs* exactly my thoughts, too... -- NOTE: No off-list assistance is given without prior approval. *Please

[fpc-pascal] GetLocaleInfo returns ZZZ

2018-02-21 Thread Darius Blaszyk
On my machine getlocaleinfo returns ZZZ when requesting the abbrev langname. The country code is correctly set to NL. This makes gettext.GetLanguageIDs return zz_NL. What could be causing this? Also the behavior of GetLocaleInfoIDs does not seem to be according to the gettext manual. On

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Michael Van Canneyt
On Wed, 21 Feb 2018, Sven Barth via fpc-pascal wrote: Am 21.02.2018 09:48 schrieb "Ryan Joseph" : On Feb 21, 2018, at 2:57 PM, Michael Van Canneyt wrote: The job of the compiler is to create correct code. Not to ensure you write

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Sven Barth via fpc-pascal
Am 21.02.2018 09:48 schrieb "Ryan Joseph" : > On Feb 21, 2018, at 2:57 PM, Michael Van Canneyt wrote: > > The job of the compiler is to create correct code. Not to ensure you write readable code. Every feature that is introduced > offers more

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Michael Van Canneyt
On Wed, 21 Feb 2018, Martok wrote: I doubt that many would be using scopedenums for that. Isn't that what they're for? {$SCOPEDENUMS ON} type TTileSortingFlag = (Static, Ramp, Ignore, Particle, Floor,

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Mattias Gaertner
On Wed, 21 Feb 2018 16:14:13 +0700 Ryan Joseph wrote: >[...] > {$scopedenums on} > type > TTileSortingFlag = (Static, > Ramp, > Ignore, > Particle, >

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Martok
> I doubt that many would be using scopedenums for that. Isn't that what they're for? {$SCOPEDENUMS ON} type TTileSortingFlag = (Static, Ramp, Ignore, Particle, Floor, Flat,

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Michael Van Canneyt
On Wed, 21 Feb 2018, Ryan Joseph wrote: On Feb 21, 2018, at 4:09 PM, Mattias Gaertner wrote: I doubt that many would be using scopedenums for that. why not? Scoped enums did clean that up a little but still lots of extra typing during assignments and

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Ryan Joseph
> On Feb 21, 2018, at 4:09 PM, Mattias Gaertner > wrote: > > I doubt that many would be using scopedenums for that. why not? Scoped enums did clean that up a little but still lots of extra typing during assignments and parameters. That compared to the previous is

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Mattias Gaertner
On Wed, 21 Feb 2018 15:58:12 +0700 Ryan Joseph wrote: >[...] > type > TTileSortingFlag = (kTileSortingStatic, > kTileSortingRamp, > kTileSortingIgnore, >

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Ryan Joseph
> On Feb 21, 2018, at 3:45 PM, Mattias Gaertner > wrote: > > I think this would be confusing: > > {$scopedenums on} > type > TMyType = (A, B, C); > {$scopedenums off} > var > A: integer; > > procedure DoThis (t: TMyType; i: integer); > begin > end; > >

[fpc-pascal] fpreport rangeerrors with TFPReportColor

2018-02-21 Thread Andreas Frieß
when i compile in Lazarus the Reportdesigner with activated RangeCheck it gives a lot of runtimeerror with rangeerrors. The definition is TFPReportColor  = type UInt32; Loading and saving in JSON is done by function ReadInteger(AName: String; ADefault: Integer): Integer; override; function

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Ryan Joseph
> On Feb 21, 2018, at 2:57 PM, Michael Van Canneyt > wrote: > > The job of the compiler is to create correct code. Not to ensure you write > readable code. Every feature that is introduced > offers more scope for abuse (generics jump to mind). I think you may change

Re: [fpc-pascal] Scoped enums and inferred types

2018-02-21 Thread Mattias Gaertner
On Wed, 21 Feb 2018 09:38:17 +0700 Ryan Joseph wrote: >[...]Doesn’t the compiler know the type and can infer “A” is relative to the >scoped enum? I understand there’s a possibility for name conflicts but you >could just use the full name in that case. I think this