Uploaded image for project: 'CloverDX'
  1. CloverDX
  2. CLO-18176

Variant operators

    XMLWordPrintable

Details

    • Story
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • rel-5-6-0
    • None
    • Security Level: Users (General product issues)
    • 5
    • UNDECIDED
    • Green Sprint 106, Green Sprint 107, Green Sprint 108

    Description

      String concatenation:

      string s = <string expression> + <variant variable> | <variant variable> + <string expression>;
      

      Example:

      variant v = 1;
      printErr("Variant variable: " + v); // prints "Variant variable: 1"
      

      Comparison operators:

      bool <variant variable> == | != <any expression>
      

      need to be extended to support comparison of variant variable with any expression. At the time of comparison execution, both the variant variable and the expression have to be of the same type (e.g. string/integer), otherwise false is returned.

      Example:

      variant val1 = 123;
      variant val2 = "ABC";
      if (val2 == "ABC") {
          // do something
      }
      
      if (val1 == "ABC") {  // returns false
          //
      }
      

      Note: new <variable type literals> were introduced to CTL in order to support “variant”
      integer, long, number, decimal, string, date. boolean, list, map, byte

      "typeof" operator:

      In addition introduce new operator bool <variant variable> typeof<variable type literal>

      syntax: _varname_  typeof  {one of variable type literal}
      

      Example:

      if (myvariant typeof string){
          //do something
      } else if (myvariable typeof integer){
          //do some else
      }
      

      Attachments

        Issue Links

          Activity

            People

              slamam Martin Slama
              slamam Martin Slama
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: