An ESS code snippet demonstrating changes introduced in esscript engine included in upcoming release of esframework version 1.23

enum Test 
  @att0 = "enum Test";
{
  a = 1;
  b = 2;
  c = 3;
  d = Test$$a+Test$$b-Test$$c, "Compile-time evaluated constexpr";
}

EsScriptDebug::log("And the Test$$d is: %d", Test$$d);

var arr = [1,2,3,4];
var rng = [11 ..123];
rng = [..123];
rng = [123 ..];
rng = [Test$$a..Test$$c];
rng = [[1,2,3,1].."123"];

function defaultArgTest(a, b, c)
@fattr = "function defaultArgTest";
var ret, fattrTest = @fattr; //< Implicit attribute access - this function declaration is used
{
  EsScriptDebug::log( "fattrTest: %s", fattrTest );

  if( !a#isEmpty() )
    ret = a;
  if( !b#isEmpty() )
  {
    if( ret#isEmpty() )
      ret = b;
    else  
      ret += b;
  }
  if( !c#isEmpty() )
  {
    if( ret#isEmpty() )
      ret = c;
    else  
      ret += c;
  }  
  return ret;
}

// Default 'wild-card' argument test. 
// So far, syntax does not support declaring custom defaults for parameters (layd-off until the future releases)
// Hence, the only wildcard meaning is 'use an empty argument value (null)'
//
var result = defaultArgTest(2, 3, 4);
EsScriptDebug::log(result);

result = defaultArgTest(2, 3, *);
EsScriptDebug::log(result);

result = defaultArgTest(2, *, 4);
EsScriptDebug::log(result);

result = defaultArgTest(*, *, *);
EsScriptDebug::log(result);

const c_val = "Constant string";

function constexprArrayVsTeporary()
var ca = 
  [c_val, 12, 49, 
    [Test@att0, //< Fully qualified attribute access - value of att0 from enum Test is used here 
    "Some other string"] 
  ], //< This is collection constexp evaluated at compile time - all items are constexprs
  str = "Some string";
{
  EsScriptDebug::log(ca);
  
  // And this is temporary collection, created on-demand.
  // It may have been constexpr, but it had at least one non-constexpr item in it - 'result' variable
  return [
    c_val,
    result,
    str
  ];
}

var tmpcoll = constexprArrayVsTeporary();
EsScriptDebug::log(tmpcoll);