[fpc-pascal] List of integers? Any class available in RTL or FCL to help?
pascaldragon at googlemail.com
Mon Dec 5 14:37:34 CET 2016
Am 05.12.2016 12:01 schrieb "denisgolovan" <denisgolovan at yandex.ru>:
> 05.12.2016, 13:35, "Sven Barth" <pascaldragon at googlemail.com>:
>> I really don't get why some people think of generics as complex -.-
> Exactly for the cited reason. See below.
> > Using plain old arrays, requires reinventing the wheel because you end
> > writing duplicate functions for each array type (array of string)
> > of a general purpose algorithm for many types..
> It's not possible to get uniform interfaces that would play nice with
> Try writing a _single_ function for sorting static arrays, dynamic
arrays,open arrays, generic containers(T*List * all value types).
> The standard recipe is re-implement everything from scratch over and over
> Even now, when we have generic functions - I am forced to specialize them
by hand! Even C# got it right...
> Another issue is that some special functions are considered "special" -
you cannot overload them (SetLength, Copy, ...).
> Yet another thing is that arrays are nice value-pretending types
(refcouting), but most generics are classes!
> We desperately need http://bugs.freepascal.org/view.php?id=30687 to get
record based generics value types back to the language.
> Basically it's all about combinatorics when combining functions.
> Either compiler does it for you, or you are forced to do it manually
> To sum up, generics in current implementation add too little while
exploding combinatorial variety of algorithms.
Again: I don't see why anyone thinks of generics as complex. Your mail did
not answer that in any way.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal