Recent

Author Topic: Generic AVLTree  (Read 2858 times)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Generic AVLTree
« on: June 27, 2017, 12:20:16 pm »
I am just porting unit Laz_AVL_Tree to generics.
Where should i put it to be suitable for integration into FPC? Generics.Trees? Generics.Collections?
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

hnb

  • Sr. Member
  • ****
  • Posts: 270
Re: Generic AVLTree
« Reply #1 on: June 27, 2017, 01:05:36 pm »
Rather Generics.Collections. The preferred way for large code base is separate .inc, maybe generics.treesh.inc (interface) and generics.trees.inc (implementation) like for dictionaries. Interface of TAVLTree can be changed in the future in the case when Delphi also implements it (so AVLTree tree must be marked as experimental). Be aware that Integration isn't sure so 3rd library might be also good idea (can be integrated in any time, when will be finished).
Checkout NewPascal initiative and donate beer - ready to use tuned FPC compiler + Lazarus for mORMot project

best regards,
Maciej Izak

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Generic AVLTree
« Reply #2 on: June 27, 2017, 03:57:08 pm »
@Pascal
Yes, just like Maciej wrote. Keep in mind the conventions that are already in place for rtl-generics.
Specialize a type, not a var.

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: Generic AVLTree
« Reply #3 on: June 27, 2017, 04:06:39 pm »
@Pascal
Yes, just like Maciej wrote. Keep in mind the conventions that are already in place for rtl-generics.
Which conventions do you mean? Delphi mode?
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Generic AVLTree
« Reply #4 on: June 27, 2017, 04:27:55 pm »
No, I mean the way how it is structured and the means that are already provided. Outside of the units it doesn't really matter what syntax you use in your own units.
What I am referring to is to keep the code consistent if you eventually want to have it included in rtl-generics (which is indeed in delphi mode,not quirks mode)
Specialize a type, not a var.

 

TinyPortal © 2005-2018