* * *

Author Topic: Generic AVLTree  (Read 741 times)

Pascal

  • Hero Member
  • *****
  • Posts: 530
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 - fpc trunk 32bit - Windows 10 Pro x64

hnb

  • Full Member
  • ***
  • Posts: 197
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: 4638
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.
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

Pascal

  • Hero Member
  • *****
  • Posts: 530
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 - fpc trunk 32bit - Windows 10 Pro x64

Thaddy

  • Hero Member
  • *****
  • Posts: 4638
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)
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus