Interesting, I didn't knew about that!


Interesting, I didn't knew about that!

While the EMBT doc explains it as shortening, it seems to be implemented as an implicit lengthening test actually (tested wit MyAttribute and MyAttributeAttribute)

Originally shared by ITDevCon European Delphi Conference

Using attributes and #RTTI to automate programming tasks with Primož Gabrijelčič

Comments

  1. Can't this cause serious ambiguity issues?

    ReplyDelete
  2. AFAICT, when you write [Something], the compiler first searches for "SomethingAttribute", and if not found, it searches for "Something". So effectively if you have both declared, the version without the "Attribute" postfix isn't accessible anymore (as an attribute).

    ReplyDelete
  3. I think it is the good practice always to name attribute classes with Attribute suffix and without T class prefix;
    so, no issues here.

    ReplyDelete
  4. I was in that room this morning! :O
    If declare MyAttribute and My, 'My' is never chosen by rtti...

    ReplyDelete
  5. This is the same behaviour as in .Net!

    ReplyDelete

Post a Comment