[fpc-devel] The (near) future of strings

Michael Van Canneyt michael at freepascal.org
Mon Mar 7 14:47:16 CET 2016



On Mon, 7 Mar 2016, Alfred wrote:

> I was assuming that a goal (first quote: UTF16) would be accompanied by (some 
> sort of) a roadmap.

Opinions are divided, hence there is no roadmap.

The main point is what to do with backwards compatibility. 
Most people do not want to give this up.

There is also the question of what to do with use of dotted units and namespaces.

There are IMHO 2 options:

1. Making String = Widestring (as Delphi did) will require work, and will
    definitely break backwards compatibility.

2. Provide 2 sets of units:
    a) one ansistring based. (basically what we have now)
    b) one widestring based.
    People wishing to continue with backwards compatible code, will use a),
    others will use b)

My personal preference is 2, with the following 'addition':

1. Provide units as they are now, where string = ansistring.

2. Provide Delphi-compatible dotted units, with string = widestring.

Basically, the user has then 2 choices:
1. is the pre-delphi 2009 option, 
2. is the Delphi 2009 and higher option

Both units can be created using a single codebase quite easily. 
I take as example the sysutils unit:

unit sysutils.pp contains {$IFDEF UNICODESTRING} to distinguish between
unicode and non-unicode code.

the dotter unit system.sysutils.pp is then the following simple file:

{$mode delphiunicode}
{$define UNICODESTRING}
{$I sysutils.pp}

The above is my personal preference, but other people in the core group may
(and do) have different preferences.

Michael.



More information about the fpc-devel mailing list