[fpc-devel] Unicode support (yet again)

DaWorm daworm at gmail.com
Sun Sep 18 17:48:28 CEST 2011


On Sep 18, 2011 5:50 AM, "Marco van de Voort" <marcov at stack.nl> wrote:
>
>  The trouble is that it is not that easy, consider the first thing a
> long time pascal user will do is fix his existing code which has many
> constructs that loop over a string:
>
> setlength(s2,s1);
> for i:=1 to length(s1) do
>  s2[i]:=s1[i];
>
> Now, to return codepoint[i], you need to parse all codepoints before [i].
>
> So instead of O(n) this loop suddenly becomes O(n^2)....

Sure it does.  So what?  The point is, it will do what the user expects.
And for most users, the fact that it does it slowly won't even matter.  For
those whom it does matter, it is a chance for them to learn the right way.
Like I said in my first post, this is an extremely complex subject.  I think
trying to optimize user code before they even write it adds even more
complexity, which slows implementation down.  Get something that works and
gives the expected results first, worry about speed later.  By the time you
finish, the CPU speed will have caught up to you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20110918/1f30b69d/attachment.html>


More information about the fpc-devel mailing list