[fpc-devel] Unicode support (yet again)
Sven Barth
pascaldragon at googlemail.com
Sun Sep 18 18:01:27 CEST 2011
On 18.09.2011 17:48, DaWorm wrote:
>
> On Sep 18, 2011 5:50 AM, "Marco van de Voort" <marcov at stack.nl
> <mailto: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.
Let me quote a saying by Pascal's father Wirth:
"Software is getting slower more rapidly than hardware becomes faster."
(see also here: http://en.wikipedia.org/wiki/Wirth%27s_law )
I personally see no reason in Pascal becoming (much) slower only because
we want to support code page aware strings (and O(n^2) IS much slower
than O(n)).
Regards,
Sven
More information about the fpc-devel
mailing list