Skip to content

Releases: killme2008/aviatorscript

[Deprecated] AviatorScript 5.2.4

09 Mar 05:48
Compare
Choose a tag to compare

New features:

  • Define anonymous function by fn syntax (instead of lambda ... -> ... end), let add = fn(x, y) { x + y); add(1, 2) for example.
  • Unpacking arguments(as sequence) by *args syntax like python, for example:
fn test(a, b, c, d) {
  a * b + c * d
}
let a = tuple(1, 2);
let list = seq.list(3, 4);
p(test(*a, *list));
  • Adds AVIATOR_DEPS environment variable to point third-party jar files directory for aviator shell command-line, default is $HOME/.aviatorscript/deps , all jar files under this directory will be added to JVM CLASSPATH .
  • Improve for statement, supports index( List/Array sequence etc.) and key/value(Map) iterating:
let a = tuple(1, 2, 3, 4, 5, 6, 7, 8, 9);
for i, x in a {
  assert(i + 1 == x);
}
let m = seq.map("a", 1, "b", 2, "c", 3);
for k, v in m {
    if k == "a" {
      assert(v == 1);
    }elsif k == 'b' {
      assert(v == 2);
    }elsif k == 'c' {
      assert(v == 3);
    }else {
      throw "should not happen";
    }
}
  • seq.array_of(Class, dimension1, dimension2, ...dimensions) to create a multidimensional array.
  • New functions to add/retrieve/remove object's metadata:
let a = 1;
## retrieve meta ,null if not found
p(meta(a)); 

## associate key/value metadata to any objects by with_meta(obj, key, value)
a = with_meta(a, "key", tuple(1, 2, 3));
p(meta(a));  ## {"key" => [1, 2, 3]}
p(meta(a, "key")); ## [1, 2, 3]

## remove metadata by without_meta(obj, key)
a = without_meta(a, "key");
p(meta(a));  
  • Bugs fixed:
    • Wrong size number of Range .
    • JUnit dependency issue, Thanks to DQinYuan

Change log details.

[Deprecated] AviatorScript 5.2.3

28 Jan 07:52
Compare
Choose a tag to compare

Main changes:

  • Removed commons-beanutils #340
  • Fixed AviatorString#toString() may print warning message.
  • Fixed missing source file and line number in string interpolation expression when throws exception.
  • New function is_distinct(seq) returns true when a sequence doesn't have duplicated elements.
  • Focus on performance turning
Aviator 5.2.3:
Benchmark                           Mode  Cnt       Score      Error   Units
PerfBenchmark.testArith            thrpt    5  108126.155 ± 6304.752  ops/ms
PerfBenchmark.testArithByAviator   thrpt    5    2565.933 ±  105.076  ops/ms
PerfBenchmark.testArithByBeetl     thrpt    5    1625.887 ±  291.247  ops/ms
PerfBenchmark.testArithByScript    thrpt    5    7050.305 ±   69.529  ops/ms
PerfBenchmark.testCond             thrpt    5   93099.759 ± 8554.585  ops/ms
PerfBenchmark.testCondByAviator    thrpt    5    1667.093 ±  112.807  ops/ms
PerfBenchmark.testCondByBeetl      thrpt    5    1617.045 ±   93.373  ops/ms
PerfBenchmark.testCondByScript     thrpt    5    6926.106 ±  267.292  ops/ms
PerfBenchmark.testObject           thrpt    5    8537.937 ±  272.512  ops/ms
PerfBenchmark.testObjectByAviator  thrpt    5    1025.725 ±   30.846  ops/ms
PerfBenchmark.testObjectByBeetl    thrpt    5     860.873 ±   33.559  ops/ms
PerfBenchmark.testObjectByScript   thrpt    5    4552.307 ±  199.507  ops/ms

Aviator 5.2.2:
Benchmark                           Mode  Cnt       Score      Error   Units
PerfBenchmark.testArith            thrpt    5  105095.308 ± 3861.646  ops/ms
PerfBenchmark.testArithByAviator   thrpt    5    2405.785 ±   78.325  ops/ms
PerfBenchmark.testArithByBeetl     thrpt    5    1628.726 ±   45.332  ops/ms
PerfBenchmark.testArithByScript    thrpt    5    7513.704 ±  286.090  ops/ms
PerfBenchmark.testCond             thrpt    5   92518.914 ± 1961.141  ops/ms
PerfBenchmark.testCondByAviator    thrpt    5     952.022 ±   32.184  ops/ms
PerfBenchmark.testCondByBeetl      thrpt    5    1647.736 ±   19.300  ops/ms
PerfBenchmark.testCondByScript     thrpt    5    7631.465 ±  404.298  ops/ms
PerfBenchmark.testObject           thrpt    5    8847.069 ±  261.799  ops/ms
PerfBenchmark.testObjectByAviator  thrpt    5     873.944 ±   26.327  ops/ms
PerfBenchmark.testObjectByBeetl    thrpt    5     826.758 ±   30.071  ops/ms
PerfBenchmark.testObjectByScript   thrpt    5    4647.178 ±  237.783  ops/ms
• Benchmark improvements:
    • testArithByAviator 6.7%
    • testCondByAviator 75%
    • testObjectByAviator 17.4%

[Deprecated] AviatorScript 5.2.2

04 Jan 10:06
Compare
Choose a tag to compare

Main changes:

  • Fixed Expression#getVariableNames() and Expression#getVariableFullNames(), they will return the global uninitialized variable names. #277 #335
  • Adds AviatorEvaluatorInstance#setCachedExpressionByDefault(boolean) to configure whether to cache the compiled expression by default when invoke compile(string), execute(string, [env]) methods etc, default value is false. #330
  • Adds a new option Options.ALLOWED_CLASS_SET with a Set<Class> value to control the allowed class list in new statement and static method/field invocation. #325
  • Adds new features Feature.StaticFields and Feature.StaticMethods. #326

changelog https://www.yuque.com/boyan-avfmj/aviatorscript/bggwx2

[Deprecated] AviatorScript 5.2.1

24 Nov 11:15
Compare
Choose a tag to compare

The change log.

If you are trying 5.2.0, please upgrade to this version, sorry.

[Deprecated] AviatorScript 5.2.0

20 Nov 09:55
Compare
Choose a tag to compare

See the 5.2.0 changelog.

Deprcated, please use 5.2.1

[Deprecated] AviatorScript 5.1.4

25 Aug 07:08
Compare
Choose a tag to compare

Main changes:

  • Fixed memory leak when compiling string interpolation lexeme.Warn when compling lexeme without caching.
  • Check function name when using fn syntax to define functions.
  • Adds AviatorEvaluatorInstance#removeModule(String) to remove java module, and adds an example JavaModuleExample.

[Deprecated] AviatorScript 5.1.3

20 Aug 02:32
Compare
Choose a tag to compare

Main changes:

  • Supports exponenent operator **(like ruby), for example:
p(2**3);  ## 8
p(2**-3);  ## 0.125

The detail rule is in doc.

  • Adds EnvProcessor to process env before or after executing expression, #224
  • Bug fixes, #278 , #272

[Deprecated] AviatorScript 5.1.2

31 Jul 08:59
Compare
Choose a tag to compare

A minor change:

  • Don't override __exp___ internal var to user pass-in env.

[Deprecated] AviatorScript 5.1.1

30 Jul 09:03
Compare
Choose a tag to compare
  • Fixed ==/!= operator can't work with variable syntax suger such as a.b.c, it may returns wrong result.

It's a recommended version to upgrade if you are using 5.x versions.

[Deprecated] AviatorScript 5.1.0 released

21 Jul 06:34
Compare
Choose a tag to compare

Thit is a major version release, it introduces some new syntax features,main changes as below:

  • Supports catching multi exceptions in one catch clause, for example:
try {
   ## do something
} catch (IllegalStateException | ArrayIndexOutOfBoundsException | java.io.IOException e) {
   pst(e);  ##print stack trace
}

It's the same as the Java 7 catch multiple exceptions.

  • String interpolation to stick strings together more easier and faster:
let name = "aviator";
let a = 1;
let b = 2;
let s = "hello, #{name}, #{a} + #{b} = #{a + b}";
p(s);

It will output the string hello,avitor,1 + 2 = 3. The expression quoted by #{} will be executed and sticked into the result string.
A new feature Feature.StringInterpolation is added into Feature enum, it's enabled by default.

  • Adds a new method AviatorEvaluatorInstance#validate(script) to validate whether a text string is a legal script.
  • Fixed #257
  • Make some internal standard functions more friend with nil argument:
nil =~/[a-zA-Z]+/;                 ## returns false when matching nil with regular pattern .
count(nil);                        ## returns 0
include(nil, element);             ## returns false
map(nil, lambda);                  ## returns nil
sort(nil);                         ## returns nil
reduce(nil, lambda, init);         ## returns the init value
filter(nil, lambda);               ## returns nil
seq.every(nil, lambda);            ## returns true
seq.not_any(nil, lambda);          ## returns true
seq.some(nil, lambda);             ## returns nil

There are some breaking changes, the user MUST note them.