[fpc-devel] Questions on TStringList.Find change (Mantis 28744)
Zoë Peterson
zoe at scootersoftware.com
Mon Mar 21 22:08:44 CET 2016
On 3/21/2016 3:44 PM, Michael Van Canneyt wrote:
> The reason for this behaviour is that find needs to be sure that the
> list is sorted.
> If it thinks the list is not sorted, the result cannot be guaranteed to be
> correct, and this is an error condition.
Then it should raise an exception, not silently exit.
IMO, it's a bad change because it forces us to set Sorted to true and
deal with the extra overhead that that introduces even for lists that we
know are sorted externally. The fact that it breaks Delphi
compatibility for little gain is another knock against it.
> TStringList is just one possible implementation of TStrings. It is only there for your ease of use.
>
> If you don't like it, you can use another one. You can find several. There is one in inifiles, the LCL probably also contains a couple.
Why would you possibly think that it's better for us to use a TStrings
implementation from IniFiles rather than the one in Classes when we want
to store a specific list of strings? That's what the core RTL classes
are for.
> If all APIs work with TStrings, then they don't care what TStrings
> descendent you use. So you are free to use one that does whatever you want.
Nobody said anything about declaring APIs. We have concrete instances
of TStringList that we're creating and encapsulating in our classes.
We're not passing in random TStrings/TStringList instances to these things.
Regardless, Find is introduced in TStringList, not TStrings.
--
Zoë Peterson
Scooter Software
More information about the fpc-devel
mailing list