[fpc-pascal] [PATCH] Addition of OnNotify event on "TFPGObjectList" and "TFPGList" triggered on the insert, delete and extract methods.
Michalis Kamburelis
michalis.kambi at gmail.com
Sat Feb 20 06:05:20 CET 2016
>> Can you send little bit sample showing this degradation? I can inform him
>> to not send the patch because this problem. (I think that him isn't
>> registered here in the list yet)
>
> There's no need for a sample. This degradation is the whole reason why the
> non-generic classes TFPObjectList and TFPList exist compared to TObjectList
> and TList which do have notifications.
Hm, two points.
1. I'm using FGL containers a lot (because I like type-safety given by
generics), and I agree that adding a notification mechanism there can
slow them down. Mostly at allocation (because a deallocation is
already burdened down by having to do Deref() on every item, so it
would probably not suffer *so much* with unassigned OnNotify).
2. But this should not stop us from making a "generic container with
notification" classes. Maybe as new classes, maybe as a boolean toggle
to existing classes (as Graeme nicely suggests).
Right now we only have "with notifications, and not type-safe"
containers (TObjectList/TList) and "without notifications, and
type-safe using generics" containers (TFPObjectList/TFPList). But
these two features (1. notifications and 2. type-safety thanks to
generics) should be independent. It makes sense to create a "with
notifications, and type-safe using generics" option.
So I would not reject the idea so quickly. But it indeed should be
implemented carefully, without slowing down the existing
TFPObjectList/TFPList.
Regards,
Michalis
More information about the fpc-pascal
mailing list