[fpc-devel] Unicode and UTF8String
fpc at mfriebe.de
Mon Dec 1 23:30:15 CET 2008
And point also taken that it's not a solution to to a "half job",
meaning overload only methods based on parameters, but not results. This
would be a false pretence, ending people n a believe they do the right
thing where they do not.
The programmer should be able to set himself what RTLString means, (with
the default being the OS depended). It isn't really a nice solution
though. But I throw it into the discussion anyway.
Otherwise I''ll have to see, If I can come up with something else.
Jonas Maebe wrote:
> On 01 Dec 2008, at 22:33, Martin Friebe wrote:
>> I suggested to have a rtl, that has overloaded functions for each
>> string type.
>> of course that sounds easier than in fact it will be.
>> Florian pointed out a few issues, like overloading by result is not
>> possible (yet?).
> No, it is fundamentally impossible. First of all, because a Pascal
> compiler does not look at how the result of an expression is used
> while parsing the expression (so while evaluating a function call, the
> compiler has no idea what the "expected" result type is). That's
> simply how Pascal works.
> And how could the compiler decide what to call here:
> function f: longint;
> function f: string;
> There are an immense amount of similar examples possible (and if you
> add operator overloading in the mix, it increases exponentially), and
> you'd get a huge amount of "can't decide which overloaded function to
> call" errors even if the compiler were hacked to take the use of the
> function results into account.
> fpc-devel maillist - fpc-devel at lists.freepascal.org
More information about the fpc-devel