typesfunctional-programmingopa

How can one determine the type of a variable in opa?


I' learning the Opa (opalang.org). I am trying to find out how one can determine the type of a variable. This could be e.g. a function

typeof a // in javascript, this returns the type of a

The API-Documentation contains a description of OpaValue.typeof(a) but I can't find out how to use it.


Solution

  • Here is a short example :

    int hello = 42
    hello_type = OpaValue.typeof(hello)
    Log.info("Hello type:", "{hello_type}")
    

    However i am surprised you want to manipulate Opa types. What is your usage ?