[fpc-devel] Packages, Generics
Florian Klaempfl
florian at freepascal.org
Mon Sep 13 13:22:07 CEST 2010
Am 13.09.2010 12:31, schrieb Willibald Krenn:
>>> OTOH 'specialize' is an additional (unfamiliar) keyword and has
>>> semantics totally unknown to the world. So why not take what's
>>> already in the language?
>>
>> As I said, to emphasis that a new type is created, generic
>> specialization is something really new to the language. The meaning
>> of type ... = type ...; is imo very unclear.
>
> Well, it's the Delphi way of creating a new type rather than an
> alias.
Since they are still assignment compatible, I don't consider it as a
really new type.
>
>>> FPC's generics are, however, very different to all other
>>> implementations of generics that I know of. And I really(!)
>>> hope, that FPC does not do the C++ like duck-typing, which could
>>> give
>>
>> FPC works in this regard as C++ which is not nice but much more
>> flexible being not only some type cast wrapper generator as in C#
>> etc.
>
> Well, you know my opinion. This is type-unsafe,
It is perfectly type safe.
> C-style, poor-man's
I consider C# style generics as poor man's generics :)
> generics.
Well, I consider them more powerful than others because the C#
programming style (having only one core implementation) can be done also
with C++ style templates, see e.g. the fgl unit of fpc.
> You are asking for trouble by following that route.
Nothing is trouble free ;)
>
> And one last time - C#/.NET generics are not only some 'type cast
> wrapper': think about working static fields, co-/contravariance ... .
Yes. But the principle remains the same.
> Java generics, however, could be described as type cast wrapper
> generators. And everybody on earth knows that Java generics are
> broken.
>
>> Let us know if you've something working and regarding the branch:
>> just tell me if you need one.
>
> Ok, thanks!
>
> Willi
More information about the fpc-devel
mailing list