Reflections on Reflection

About Monkey 2 Forums Monkey 2 Programming Help Reflections on Reflection

Tagged: 

This topic contains 3 replies, has 2 voices, and was last updated by  Mark Sibly 1 year, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #10572

    Ethernaut
    Participant

    I’m trying to get the value of a DeclInfo object as a String.

    The Get() method returns a Variant. I’m trying to cast the variant, but it keeps failing. What do I have to do to cast a Variant? In the code below, I tried a case-by-case casting, but that still doesn’t work:

    One mo’ question:

    TypeInfo.GetDecls() returns ALL decls, Public, Private, Protected, etc. Is there a way to filter only the public ones (without  changing the way they’re named)?

    Thanks!

    #10653

    Ethernaut
    Participant

    Answering my own questions, if anyone has the same questions:

    1. Where it  says “d.Get( d )”, it should say “d.Get( Self )”, since we’re calling this method from the instance I’m inspecting. Duh!
    2. Couldn’t filter by “Public”, but there’s an undocumented DeclInfo.Kind, “Property” (docs only mention Field, Global, Method and Function). That’s actually good enough for me.

    Cheers!

    #10654

    Mark Sibly
    Keymaster

    What do you mean by failing – what error are you getting/

    Can you post something buildable/runnable?

    #10655

    Mark Sibly
    Keymaster

    Beat me to it! Yes, Kind needs to be documented (supposedly is…). Will add IsPublic, IsProtected, IsPrivate (or equivalent) too.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.