In Generics.Collections:
In Generics.Collections:
TList = class
..
// function ToArray: TArray; // pending compiler support
..
end;
Real nice job there, making it really tedious to get a dynamic array from a TList... Anyone know when said compiler support was added?
TList
..
// function ToArray: TArray
..
end;
Real nice job there, making it really tedious to get a dynamic array from a TList
In XE - the compiler support missing before was that the implementation of the ToArray method did not compile.
ReplyDeleteCheers, Generics in D2010 is a trial in patience :)
ReplyDeleteIf you are using D2010 either upgrade or stay away from generics if you want to stay sane ;)
ReplyDeleteI'm starting to notice heh... Oh well, hopefully we'll upgrade shortly.
ReplyDeleteTo be fair D2010 fixed a lot of problems that existed in D2009. Generics in D2009 was a mine field.
ReplyDeleteD2009 generics was pretty much alpha code no?
ReplyDeleteMore or less. Generics in 2009 were alpha, 2010 was beta, XE was the first really usable release for anything more than toy projects or very short lived containers.
ReplyDeleteGenerics are still far from being ideal and I don't expect that to be changed unless they rethink their implementation. While doing the refactorings in Spring4D (which initially was started to reduce the binary size growth for each TList) I got to the point multiple times where compiling a project with many generic specializations took multiple minutes instead of a couple seconds.
ReplyDeleteStefan Glienke The compiler is a hedgehog, you will get hurt once you touch it...
ReplyDeleteStefan Glienke That's a shame. I wonder how the next gen compiler for iOS on XE4 behaves?
ReplyDeleteStefan Glienke After 5 years with C++, I'm used to compilation taking a wee bit time. On the other hand, I'm also used to templates, which I find superior to generics. Just about every time I try to use generics I end up wishing I had templates instead.
ReplyDeleteXE4 has a lot of fixes for generics.
ReplyDeleteIn XE2 generics still messes up code completion an error insight :(
ReplyDeleteMichael Justin Then you most likely never did much more than putting some items into a list. And FPCs generics aren't fully implemented aswell (try generic specialization inside a method and see the compiler errors)
ReplyDelete