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?

Comments

  1. In XE - the compiler support missing before was that the implementation of the ToArray method did not compile.

    ReplyDelete
  2. Cheers, Generics in D2010 is a trial in patience :)

    ReplyDelete
  3. If you are using D2010 either upgrade or stay away from generics if you want to stay sane ;)

    ReplyDelete
  4. I'm starting to notice heh... Oh well, hopefully we'll upgrade shortly.

    ReplyDelete
  5. To be fair D2010 fixed a lot of problems that existed in D2009. Generics in D2009 was a mine field.

    ReplyDelete
  6. D2009 generics was pretty much alpha code no?

    ReplyDelete
  7. More 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.

    ReplyDelete
  8. Generics 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.

    ReplyDelete
  9. Stefan Glienke The compiler is a hedgehog, you will get hurt once you touch it...

    ReplyDelete
  10. Stefan Glienke That's a shame. I wonder how the next gen compiler for iOS on XE4 behaves?

    ReplyDelete
  11. Stefan 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.

    ReplyDelete
  12. XE4 has a lot of fixes for generics.

    ReplyDelete
  13. In XE2 generics still messes up code completion an error insight :(

    ReplyDelete
  14. Michael 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

Post a Comment