[fpc-pascal] List of integers? Any class available in RTL or FCL to help?

Lars noreply at z505.com
Mon Dec 5 11:01:04 CET 2016


This topic title brings back nostalgia as I needed an integer list before,
and found some, either in the contributed units section of fpc, or in some
old turbopascal units by a company.. TurboPower with Julian Bucknall, or
something similar.  As I looked through the code, I wondered if fpc and
delphi really needed something more like a general purpose associative
array or similar.. as it seemed people were reinventing it all the time
over and over.

I believe I found some code on sourceforge, maybe it was that company that
used to sell code for turbopascal called TurboPower, which I think Julian
Bucknall worked for and they made casino software that ran on dos and
powered casino machines.. But I could be recalling incorrect.

There is even old classic 1980's stuff like this:
http://www.drdobbs.com/cpp/container-object-types-in-turbo-pascal/184408235
An article in 1989 by Anders himself.... But that may be unrelated.

With data structures like this it does seem people are reinventing it,
especially when people use a TStringList to store integers (I have done
this before, a shame indeed, bad programming practice)... Or complex
generics which just seems like over engineering, but at least it works.
Using plain old arrays, requires reinventing the wheel because you end up
writing duplicate functions for each array type (array of string) instead
of a general purpose algorithm for many types..

I guess that is why some people prefer dynamic typed languages because you
can write general algorithms for many types without reinventing the wheel.
But with static languages it is still possible, as GoLang has a
associative array, maps, etc without resorting to complex generics.

Sometimes I got so tired of inventing a intlist that I just ended up using
a TStringList to store integers, which... was bad. but worked.


More information about the fpc-pascal mailing list