On 26.09.2013 08:46, Xiangrong Fang wrote:
2013/9/26 Xiangrong Fang <xrf...@gmail.com <mailto:xrf...@gmail.com>>


    Which output:

    TIntTree
    TIntTree.TTree$LongInt


Forgot to ask, I understand that TTree$LongInt is the name the compiler
gave to the generic class when it is specialized, but what is
TIntTree.TTree$LongInt?  What is the meaning of "Scoped" type (or type
with "namespace"?)?

Your TIntTree is declared like this:

=== code begin ===

type
  TIntTree = class(specialize TTree<Integer>)
  end;

=== code end ===

What the compiler now does is when it encounters the specialization it generates a new type definition of that type (globally in the current module, so that it can be reused by e.g. other classes) and adds a local symbol reference to that type. So for code it appears that the parent type was declared as a nested type inside the child type.

Regards,
Sven

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to