Imports System
Imports uCalcSoftware
Public Module Program
   
   Public Sub DescribeArg(ByVal cb As uCalc.Callback)
      '// Retrieve the Item object for the first argument.
      Dim item = cb.ArgItem(1)
      
      '// Inspect the item's metadata.
      Dim name = item.Name
      If Len(name) = 0 Then
         name = "(literal)"
      End If
      
      Console.WriteLine($"  - Name: {name}, Type: {item.DataType.Name}")
   End Sub
   Public Sub Main()
      Dim uc As New uCalc()
      uc.DefineFunction("Describe(ByHandle arg As AnyType)", AddressOf DescribeArg)
      uc.DefineVariable("my_var = 100")
      
      Console.WriteLine("Inspecting a variable:")
      uc.Eval("Describe(my_var)")
      
      Console.WriteLine("Inspecting a literal value:")
      uc.Eval("Describe(123.45)")
      
      Console.WriteLine("Inspecting a string value:")
      uc.EvalStr("Describe('abc xyz')")
   End Sub
End Module