[fpc-pascal] Generic String Functions
Michael Schnell
mschnell at lumino.de
Fri Feb 28 15:24:46 CET 2014
On 02/28/2014 03:08 PM, Sven Barth wrote:
> It is possible as some mails a few months back have shown. If you have
> a function that has a RawByteString return type then you can assign
> that to a string of any static encoding even if the dynamic encoding
> is not the same (and then static and dynamic encoding of the string
> variable will not match, nevertheless the RTL and the compiler will
> handle them correctly (at least I hope so ^^).
I don't have any Unicode Delphi so I can't test that and as far as I am
informed the implementation of "new Delphi strings" in the fpc RTL is
still a moving target.
In many discussions I was told that the Delphi "RAW" type does not
provide the features necessary to a fully dynamically encoded String,
even though when I first read the online Delphi docs, I had the
impression that it should.
.
> The non-conversion nature of RawByteString has its use.
I don't doubt this at all. That is why I don't suggest to modify it's
behavior but to introduce yet another String encoding type.
The functionality for this is already in place in the (future) RTL, only
the (really small) compiler magic to call conversions "when necessary"
needs to be added and called if a string of this type definition is to
be handled. (Easy with pure assignments, as discussed in that thread
pos(), copy() and friends need some more re-thinking.)
-Michael
More information about the fpc-pascal
mailing list