Recent

Author Topic: What are the major differences between TObjectList and TFPObjectList  (Read 480 times)

Gustavo 'Gus' Carreno

  • Sr. Member
  • ****
  • Posts: 499
  • Professional amateur ;-P
Hey all,

Ever since I decided to play with JSON stuff I decided to make the array part a TFPObjectList which contains what ever is needed.

At the time, and it was quite a long time ago, I read something that got me on the TFPObjectList track, but now I can't, for the love of all that is holy, remember my initial decision.

Can someone elaborate on the major differences between the two?
At least now I'll have a link to something I can refer later.

Many, many thanks in advance!!

Cheers,
Gus
Lazarus 2.1.0(trunk) FPC 3.3.1(trunk) Ubuntu 20.10 64b Dark Theme
Lazarus 2.0.12(stable) FPC 3.2.0(stable) Ubuntu 20.10 64b Dark Theme
http://github.com/gcarreno

jamie

  • Hero Member
  • *****
  • Posts: 4440
Re: What are the major differences between TObjectList and TFPObjectList
« Reply #1 on: March 23, 2021, 12:54:11 am »
They are both the same except for the TObjectlist has a notifier event in the base class that can be inserted in a list of observers or be an observer itself.
 
 These events take place when ever an item is inserted, deleted etc. the those on the list will get notified of the event.

 if you don't need that you can stick with the TfpObjectlst which might make it a little faster, maybe,.
The only true wisdom is knowing you know nothing

Gustavo 'Gus' Carreno

  • Sr. Member
  • ****
  • Posts: 499
  • Professional amateur ;-P
Re: What are the major differences between TObjectList and TFPObjectList
« Reply #2 on: March 23, 2021, 10:15:34 pm »
Hi Jamie,

Thank you so much for the answer!!

I now get why I did choose TFPObjectList and it was due to the fact that I wasn't gonna use the notification system.

Again, thanks for helping me untangle my old faulty memory!!

Cheers,
Gus
Lazarus 2.1.0(trunk) FPC 3.3.1(trunk) Ubuntu 20.10 64b Dark Theme
Lazarus 2.0.12(stable) FPC 3.2.0(stable) Ubuntu 20.10 64b Dark Theme
http://github.com/gcarreno

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9262
  • FPC developer.
Re: What are the major differences between TObjectList and TFPObjectList
« Reply #3 on: March 23, 2021, 10:32:25 pm »
So basically TFPList and TFPObjectList are the TList from Delphi versions before the notifications were introduced. (D4? D6?)

jamie

  • Hero Member
  • *****
  • Posts: 4440
Re: What are the major differences between TObjectList and TFPObjectList
« Reply #4 on: March 23, 2021, 10:53:10 pm »
TList is in D3 so I don't know...
they came along at some point..
The only true wisdom is knowing you know nothing

lucamar

  • Hero Member
  • *****
  • Posts: 3859
Re: What are the major differences between TObjectList and TFPObjectList
« Reply #5 on: March 24, 2021, 04:40:07 am »
[...] the TList from Delphi versions before the notifications were introduced. (D4? D6?)

TList is in D3 so I don't know...
they came along at some point..

TList has been in Delphi since v1. In fact, IIRC TP6 (or 7) had an old-style object version of it (part of Turbo Vision, I think).
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9262
  • FPC developer.
Re: What are the major differences between TObjectList and TFPObjectList
« Reply #6 on: March 24, 2021, 11:44:59 am »
TList is in D3 so I don't know...
they came along at some point..

I didn't say otherwise. I just said that TFPList resembles early delphi versions before notifications were introduced, which weren't in since D1.

This because notifications made TList slower.

 

TinyPortal © 2005-2018