Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-05

Setting string to be UnicodeString by default

9 messages · 6 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Olivier Sannier

Hello all,

Is there a way to force the string type to be an alias to UnicodeString instead of AnsiString as it is by default?
I tried the obvious "type string = UnicodeString" but of course it is not allowed as string is a reserved keyword.

Regards

Jonas Maebe
to Olivier Sannier

Olivier Sannier wrote on Tue, 15 May 2012:

Is there a way to force the string type to be an alias to UnicodeString instead of AnsiString as it is by default?

It is not possible in FPC 2.6.x. Wth the svn trunk version, you can use {$modeswitch unicodestrings} (in combination with {$h+}), or even better {$mode delphiunicode} (which also enable other modeswitches that have been implemented for Delphi2009+ compatibility).

Jonas

Mattias Gaertner
to Jonas Maebe
Show quoted text 10 lines
Olivier Sannier wrote on Tue, 15 May 2012: > Is there a way to force the string type to be an alias to > UnicodeString instead of AnsiString as it is by default? It is not possible in FPC 2.6.x. Wth the svn trunk version, you can use {$modeswitch unicodestrings} (in combination with {$h+}), or even better {$mode delphiunicode} (which also enable other modeswitches that have been implemented for Delphi2009+ compatibility).

Is this new mode only a temporary experiment or will it stay?

Mattias

Jonas Maebe
to Mattias Gaertner

Mattias Gaertner wrote on Tue, 15 May 2012:

Show quoted text 9 lines
On Tue, 15 May 2012 10:43:19 +0200 Jonas Maebe wrote: > It is not possible in FPC 2.6.x. Wth the svn trunk version, you can > use {$modeswitch unicodestrings} (in combination with {$h+}), or even > better {$mode delphiunicode} (which also enable other modeswitches > that have been implemented for Delphi2009+ compatibility). Is this new mode only a temporary experiment or will it stay?

It will stay afaik, although the effects may still change to better match Delphi2009+ compatibility if required.

Jonas

Marcos Douglas
to Jonas Maebe
Jonas Maebe wrote 18 lines
Mattias Gaertner wrote on Tue, 15 May 2012: > On Tue, 15 May 2012 10:43:19 +0200 > Jonas Maebe wrote: > >> It is not possible in FPC 2.6.x. Wth the svn trunk version, you can >> use {$modeswitch unicodestrings} (in combination with {$h+}), or even >> better {$mode delphiunicode} (which also enable other modeswitches >> that have been implemented for Delphi2009+ compatibility). > > > Is this new mode only a temporary experiment or will it stay? It will stay afaik, although the effects may still change to better match Delphi2009+ compatibility if required.

I would like to understand why Delphi compatibility is so important to FPC and Lazarus.

Marcos Douglas

OBones
to Marcos Douglas
Marcos Douglas wrote 18 lines
On Tue, May 15, 2012 at 6:16 AM, Jonas Maebe wrote: > > Mattias Gaertner wrote on Tue, 15 May 2012: > >> On Tue, 15 May 2012 10:43:19 +0200 >> Jonas Maebe wrote: >> >>> It is not possible in FPC 2.6.x. Wth the svn trunk version, you can >>> use {$modeswitch unicodestrings} (in combination with {$h+}), or even >>> better {$mode delphiunicode} (which also enable other modeswitches >>> that have been implemented for Delphi2009+ compatibility). >> >> Is this new mode only a temporary experiment or will it stay? > > It will stay afaik, although the effects may still change to better match > Delphi2009+ compatibility if required. I would like to understand why Delphi compatibility is so important to FPC and Lazarus.

In my case, I'm generating a DLL on the fly with FPC, a Dll that interfaces with Delphi XE2 and that is based on code written by the software users.
Those users don't care that UnicodeString should be used, they only know of string and don't want to change all their scripts because we moved to a unicode version of Delphi. Hence the need to follow what Delphi has done and change string to be unicodestring.
I'm not saying it is a good or bad thing, I don't want to start a debate here, I just want to say that I'd prefer if I wouldn't have to reparse my users code to replace "string" with "UnicodeString" just before generating.

Tomas Hajny
to Marcos Douglas: I would like to understand why Delphi compatibility is so important to FPC and Lazarus.…
Marcos Douglas wrote 21 lines
On Tue, May 15, 2012 at 6:16 AM, Jonas Maebe wrote: > Mattias Gaertner wrote on Tue, 15 May 2012: >> On Tue, 15 May 2012 10:43:19 +0200 >> Jonas Maebe wrote: >> >>> It is not possible in FPC 2.6.x. Wth the svn trunk version, you can >>> use {$modeswitch unicodestrings} (in combination with {$h+}), or even >>> better {$mode delphiunicode} (which also enable other modeswitches >>> that have been implemented for Delphi2009+ compatibility). >> >> >> Is this new mode only a temporary experiment or will it stay? > > > It will stay afaik, although the effects may still change to better > match > Delphi2009+ compatibility if required. I would like to understand why Delphi compatibility is so important to FPC and Lazarus.

In that case I suggest asking on the fpc-other list.

Tomas

Jonas Maebe
to Marcos Douglas: I would like to understand why Delphi compatibility is so important to FPC and Lazarus.…

Marcos Douglas wrote on Tue, 15 May 2012:

I would like to understand why Delphi compatibility is so important to FPC and Lazarus.

Please hold that discussion on the fpc-other mailing list instead. This list is for getting help with using and programming in current FPC versions, and discussions like the above tend to explode and drown out any threads about concrete questions.

Thanks,

Jonas
FPC mailing lists admin

Marcos Douglas
to Jonas Maebe
Tomas Hajny wrote
In that case I suggest asking on the fpc-other list.

*

Jonas Maebe wrote
Please hold that discussion on the fpc-other mailing list instead. This list is for getting help with using and programming in current FPC versions, and discussions like the above tend to explode and drown out any threads about concrete questions.

*

I'm sorry.
Well, I not was real question... just a though.
I think compatibility is very important and compatibility with other compiler is, at minimal, curious for me -- and I'm a Delphi programmer too.
But if you (and everybody) do not think the same, ok let's forget my comment. ;-)

Marcos Douglas
PS: OBones, I saw your comments, thanks.