[fpc-devel] What is the status of fpc generics.collections.

Gennady Agranov gennadyagranov at gmail.com
Mon Nov 24 22:57:17 CET 2014


Hi,

I have found the old announcement about fpc-generics-collections, but all
links are broken...

What is the status of this project?

Is it still downloadable?

Thank you,
Gennady
 [fpc devel] Library announcement: Generics.Collections
<https://www.mail-archive.com/search?l=fpc-devel@lists.freepascal.org&q=subject:%22%5Bfpc-devel%5D+Library+announcement%3A+Generics.Collections%22>

Maciej Izak
<https://www.mail-archive.com/search?l=fpc-devel@lists.freepascal.org&q=from:%22Maciej+Izak%22>
Wed,
22 May 2013 12:45:20 -0700
<https://www.mail-archive.com/search?l=fpc-devel@lists.freepascal.org&q=date:20130522>

Hi Free Pascal community!

I'm pleased to announce the generic library, compatible with Delphi
Generics.Collections (almost ;) ).

Homepage
https://code.google.com/p/fpc-generics-collections/

SVN
http://fpc-generics-collections.googlecode.com/svn/trunk/


=== modules ===

  Generics.Defaults
  Generics.Collections
  Generics.Helpers
  Generics.Hashes

=== compatible classes ===

  TEnumerator<T>
  TEnumerable<T>
  TList<T>
  TQueue<T>
  TStack<T>
  TDictionary<TKey, TValue>
  TObjectList<T: TObject>
  TObjectStack<T: TObject>
  TObjectDictionary<TKey, TValue>

=== renamed (because compiler limations/bug) ===

  TArrayHelper<T> instead of TArray<T>

=== additional classes ===
  ************
  TDictionary<TKey, TValue, TProbeSequence, THash, THashFactory>
  TObjectDictionary<TKey, TValue, TProbeSequence, THash, THashFactory>

    TKey - key, TValue - value, THashFactory - hash factory :)
    TProbeSequence - TProbeSequence is special record for open addresing.
To choose from a predefined:
      TLinearProbing, TQuadraticProbing, TDoubleHashing,
      TFastLinearProbing, TFastQuadraticProbing, TFastDoubleHashing (fast
version is without "mod")
      more info at http://en.wikipedia.org/wiki/Open_addressing
    THash - type for hash (to reduce size of dictionary - can be UInt8,
UInt16, UInt32 etc.)

    For example, Delphi TDictionary version in this library is defined as:
    TDictionary<TKey, TValue> = class(TDictionary<TKey, TValue,
TFastLinearProbing, UInt32, TDelphiHashFactory>);
  ************
  TDictionaryList<TKey, TValue, TIndex, THash, THashFactory>
    class, that combines a TList and TDictionary

    TKey - key, TValue - value, THashFactory - hash factory :)
    TIndex - type for index (to reduce size of dictionary - can be UInt8,
UInt16, UInt32 etc.)
    THash - type for hash (to reduce size of dictionary - can be UInt8,
UInt16, UInt32 etc.)
  ************
  Similar to TList, TDictionary and TDictionaryList, but uses normal
operators instead of IEqualityComparer.

  TFastList
  TFastDictionary
  TFastDictionaryList
  ************
  TFastArrayHelper<T> - similar rules as above

=== not implemented ===

  TThreadedQueue<T>

=== FAQ ===

1. How to use record as Key or Value in dictionary?

  You need to wait for some compiler magic ( system functions
GetReferenceToValue and GetValueSize described bolow)
  or add two methods to record:

    TRecord = record
      (* ... *)
      function GetValueSize: Integer; inline;
      function GetReferenceToValue: Pointer; inline;
    end;

2. How to use Pointer or some custom type as Key or Value in dictionary?

  You need to wait for some compiler magic ( system functions
GetReferenceToValue and GetValueSize described bolow)
  or use TValueHelper:

    uses
      Generics.Collections, Generics.Helpers;
    (* ... *)
      type
        TValueHelperPointer = TValueHelper<Pointer>;
      var
        d: TDictionary<TValueHelperPointer, string>;
      begin
        (* ... *)
        d.Add(nil, 'foo');

=== TODO ===

Comparer from Generics.Defaults can be optimized.

I have no knowledge of FPC compiler design, so i need a little help...

First thing : To finish my work I need critical compiler magic
functions/feature. At first look mayby there is no sense for this functions
but during work on Generic library it's necessary:

  function GetReferenceToValue(Value: T): Pointer; // for string types
return @s[1] or nil for empty string for Int32 return @i etc. returns a
reference to the value, as

measured by human/programmer
  function GetValueSize(Value: T): Integer; // for string types return
Length(s), for Int32 returs 4 etc.

This functions should be implemented as operators (like Inc, Dec operators).

There is half-workaround/cripled solution as record/type helpers (module
Generics.Helpers). Don't work for custom strings, and for custom "basic"
types like:

  type MyStr = type string;
  type MyInt = type Int32;

Second thing: Bugs. Look at Critical - fix is needed to perform
compatibility with Delphi and proper work.

      http://bugs.freepascal.org/view.php?id=24283 (CRITICAL! Very
Important!)
      http://bugs.freepascal.org/view.php?id=24282 (CRITICAL! Very
Important!)
      http://bugs.freepascal.org/view.php?id=24254 (CRITICAL! for
TArray.Sort<T>)
      http://bugs.freepascal.org/view.php?id=24287 (Very Important!)
      http://bugs.freepascal.org/view.php?id=24072 (Very Important!)
      http://bugs.freepascal.org/view.php?id=24097 (Important!)
      http://bugs.freepascal.org/view.php?id=24064 (Important!)
      http://bugs.freepascal.org/view.php?id=24071 (Important!)
      http://bugs.freepascal.org/view.php?id=24285 (Important!)
      http://bugs.freepascal.org/view.php?id=24286 similar to 24285
      http://bugs.freepascal.org/view.php?id=24458
      http://bugs.freepascal.org/view.php?id=24098 (Frustrating)
      http://bugs.freepascal.org/view.php?id=24073
      http://bugs.freepascal.org/view.php?id=24463


-- 
Regards,
HNB

_______________________________________________
fpc-devel maillist  -
fpc-devel at lists.freepascal.orghttp://lists.freepascal.org/mailman/listinfo/fpc-devel


   - Previous message
   <https://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg29241.html>
   - View by thread
   <https://www.mail-archive.com/fpc-devel@lists.freepascal.org/thrd9.html#29246>
   - View by date
   <https://www.mail-archive.com/fpc-devel@lists.freepascal.org/mail9.html#29246>
   - Next message
   <https://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg29253.html>


   - [fpc-devel] Library announcement: Generics.Collections Maciej Izak
   -
      - [fpc-devel] Re: Library announcement: Generics.Col...
      <https://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg29253.html>
Maciej
      Izak
      - Re: [fpc-devel] Library announcement: Generics.Col...
      <https://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg29255.html>
Sven
      Barth
      -
         - Re: [fpc-devel] Library announcement: Generics...
         <https://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg29258.html>
Maciej
         Izak
         -
            - Re: [fpc-devel] Library announcement: Gene...
            <https://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg29259.html>
Sven
            Barth
         - Re: [fpc-devel] Library announcement: Generics...
         <https://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg29260.html>
Marco
         van de Voort
         -
            - Re: [fpc-devel] Library announcement: Gene...
            <https://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg29261.html>
Sven
            Barth

  Reply via email to
  [image: The Mail Archive] <https://www.mail-archive.com/>

   - The Mail Archive home <https://www.mail-archive.com/>
   - fpc-devel - all messages
   <https://www.mail-archive.com/fpc-devel@lists.freepascal.org/>
   - fpc-devel - about the list
   <https://www.mail-archive.com/fpc-devel@lists.freepascal.org/info.html>
   - Previous message
   <https://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg29241.html>
   - Next message
   <https://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg29253.html>


   - <https://www.mail-archive.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20141124/47084569/attachment.html>


More information about the fpc-devel mailing list