[fpc-devel] Unicode and UTF8String

Martin Friebe fpc at mfriebe.de
Mon Dec 1 16:06:45 CET 2008


Florian Klaempfl wrote:
> Martin Friebe schrieb:
>   
>> In other words, write pascal code, just do not use some of the (imho)
>> most common elements of pascal syntax?
>> I acknowledge a language is a living thing, and needs to be adjusted to
>> the new things, that come up over time. I only ask, if this is the best
>> way?
>>     
>
> We're open to proposals, make one.
>
>   
Well, RTLString will have it's place, same as something like 
RawByteString would. It sounded to me, that this will be the only way of 
communicating with the RTL.

My opinion is that it should be the programmers choice. I a programmer 
wants or needs a simpler way (keeping all the strings in is application 
in one format, which will be known to him) then he/she should have that 
choice. And then on this type the person could perform any index or 
index-like operation.

That would mean that in order to avoid conversation, some functions of 
the RTL would be needed in overloaded versions for each string type.
IMHO this applies only to those, which do not (or not always) make calls 
to the OS. Any other function does the conversation anyway. (It will be 
a case by case base)

It is nothing urgent, as it can always be added to the RTL. In the end 
this is an optimization, not a feature.

All the code
  Widestring := RtlFunction;
  Utf8string := RtlFunction;
will run, it may just perform badly.

And that is my point. Not everyone using pascal, is an expert. Pascal is 
also an attractive language to beginners. And not every bit of code will 
be written for a bg application; some may go into a small tool, for a 
very specific task at hand. There may be valid reasons to not keep every 
string in your code as RTLString.
I believe FPC should do a good job for this kind of code too?

Anyway. I know "Patches are welcome" .... Unfortunately at the moment I 
will have to keep it to contribute ideas.

Also it would be nice (so I do not know how) not to have to duplicate 
code, in order to archive this. Something like generics, maybe.

Best Regards
Martin




More information about the fpc-devel mailing list