[fpc-pascal] The new Delphi compatible unicode string
Juha Manninen
juha.manninen62 at gmail.com
Tue Jan 4 13:20:55 CET 2011
michael.vancanneyt at wisa.be kirjoitti tiistai 04 tammikuu 2011 12:42:44:
> On Tue, 4 Jan 2011, Juha Manninen wrote:
> > This component would really benefit from the Delphi2009 default string
> > type. All string encoding problems would be solved automatically.
>
> That is simply not correct.
>
> I am in the process of converting a D7 application to a D2010 application.
> There are lots of string encoding problems, and none of them is solved
> "automatically".
What kind of problems did you have?
I used Delphi 2009 for a while at my former workplace. At least it worked with
my existing Delphi programs amazingly well. The compiler sometimes warned
about automatic conversion between string types but still it worked.
The string uses UTF-16 encoding and converts automatically from other string
types. It pretty much solves the unicode encoding problems automatically, IMO.
If there is again some detail of unicode that I don't understand, I am willing
to learn more.
My guess is the problems come with old pascal code with shortstrings and
pointers. (?)
> Furthermore, if you need to support both the old and new string type
> (i.e. keep it compilable with older Delphi/FPC versions) you'll always
> need IFDEFS in your code.
No, my whole idea is to modernize the code and NOT support old versions.
There are already 2 maintained versions that support old compilers and old
string types.
I am often questioning myself if it makes sense to use this historical
language.
As you know most programmers consider it a dead or at least a dying language.
However it is advancing to a right direction so I am still here.
The problem seems to be more the old code base and the programmers' attitude
against using the modern features.
If I told to a Java programmer that Object Pascal features match Java
features, how would I prove it? By showing him the HTML component code?
IFDEFs and self-made conversion funcs just to support different string types.
The Java guy would ask if there is any common unicode string type. I would say
"Not yet but it's coming, but we can't use it because we must support the old
compiler versions".
The code also has lots of containers and thousands of typecasts to access
their elements which could be eliminated by using generics containers.
I would explain to the Java person: "Object Pascal already has generics but we
can't use them because we must support the historical Pascal syntax".
I would also laugh if I was the Java developer.
So, the minimum requirements for the modernized HTML component would be Delphi
2009 / FPC with the new unicode support.
Juha
More information about the fpc-pascal
mailing list