[Lazarus] Does Lazarus support a complete Unicode Component Library?
Jürgen Hestermann
juergen.hestermann at gmx.de
Tue Feb 22 18:37:55 CET 2011
Hans-Peter Diettrich schrieb:
> Generic types should never evolve in a breaking way.
But that's the whole reason for generic types: They should
not map to a specific type but vary dependend on certain
environment settings. If the generic type String means
the same type all the time than it's just an alias for
that type.
I never understood how this can be of advantage but that's
the reason for the design of generic types.
> Look how even the FPC developers have banned the use of AnsiString,
for performance reasons.
Yes, therefore I would never use generic types. If ShortStrings
are enough for my program, I use them (for performance reasons
and ease of use). If it comes to strings longer than 255 characters
or other features of AnsiStrings I use AnsiStrings. But I would never
leave it to some obscure environment setting what is chosen.
Still this is the way the generic type String is designed.
> Adding encodings to the string type looks to me like turning
"integer" into "complex".
But what exactly should be the type "String"? Because of the generic
nature it must map to different string types under certain environment
conditions. Otherwise it would be just another name for a fixed string type.
>> But unfortunately the powers that be, decided that its evolution should
>> magically stop at 32-bits - no idea why really.
> This specific issue was discussed in depth, across all platforms and
languages.
> When somebody needs a guaranteed "capacity" for his integral numbers,
> he can choose from many representations (Currency, Int64, BCD...) or,
in Pascal,
> he can use subranges. Where "subrange" does not necessarily mean less
than 32 bits,
> but could be extended to any bitcount.
Again, what reason exists for a generic integer type
if not providing the "best" integer representation
for a certain platform? If you compile for DOS it
should be 16 bit, for Win32 it should be 32 bit and
of course for Win64 it needs to be 64 bit.
Either you vary it or not. If there is no variation
then what reason exists for a generic type?
More information about the Lazarus
mailing list