[fpc-devel] new string - question on usage
Jonas Maebe
jonas.maebe at elis.ugent.be
Wed Oct 12 10:13:51 CEST 2011
On 12 Oct 2011, at 09:56, Marco van de Voort wrote:
> If it was just one class it would work. But essentially it is all
> OOP. (e.g.
> tcomponent and tcontrol has string properties, and thus the whole of
> lazarus),
Lazarus doesn't have to change anything. They are free to follow the
path you proposed for FPC: ship two completely separate LCLs (one
compiled with string = unicodestring and one compiled with string =
ansistring).
> same for the OOP parts of packages/ It would also mean rewriting
> delphi code using such schemes to be encoding agnostic to follow this.
If a class in the RTL or packages is by nature already encoding-
agnostic, the rewriting would consist of this:
type
tcomponent =
FpcStringModeDifferentiatedType(tansicomponent,tunicodecomponent);
generic tgenericcomponent<T> = class
..
end;
tansicomponent = specialize tcomponent<ansistring>;
tunicodecomponent = specialize tcomponent<unicodestring>;
(or use the Delphi variant of the generic syntax). That would indeed
require some ifdefs to keep the code compilable also by Delphi. No
solution will be completely free.
Jonas
More information about the fpc-devel
mailing list