加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

MiniScript脚本语言扩展

发布时间:2020-12-14 17:01:30 所属栏目:大数据 来源:网络整理
导读:脚本语言 个人评价 说明 Groovy +++ Jython / python的java实现 Rhino ++ javascript的java实现 JudoScript - Beanshell + Jess / Jelly / BeanScriptingFramework / Tcl/Java / JRuby / Ruby的java实现 Pnuts / ObjectScript +++ Seppia -- Sleep + 类似per
脚本语言 个人评价 说明
Groovy +++
Jython / python的java实现
Rhino ++ javascript的java实现
JudoScript -
Beanshell +
Jess /
Jelly /
BeanScriptingFramework /
Tcl/Java /
JRuby / Ruby的java实现
Pnuts /
ObjectScript +++
Seppia --
Sleep + 类似perl
PHP/Java Bridge /
Inline:Java /
LauJava -
Yoix ++
Hecl -
JBasic - Basic的java实现

Benchmarks:

Results for ObjectScript: bench.os
Test Time (ms)
simple loop:? 646
simple fxn:? 1426
simple fxn with arg:? 4079
simple fxn with local:? 3185
member dereference:? 1026
string concat:? 3
java class access:? 1511
total:? 11876
Results for Rhino: bench.js
Test Time (ms)
simple loop:? 1676
simple fxn:? 2640
simple fxn with arg:? 3090
simple fxn with local:? 2645
member dereference:? 1881
string concat:? 6542
java class access:? 2944
total:? 21418
Results for Jython: bench.py
Test Time (ms)
simple loop:? 4492
simple fxn:? 5901
simple fxn with arg:? 6591
simple fxn with local:? 6044
member dereference:? 5917
string concat:? 285
total:? 29230
Results for BeanShell: bench.bsh
Test Time (ms)
simple loop:? 15986
simple fxn:? 28547
simple fxn with arg:? 35311
simple fxn with local:? 36185
member dereference:? 17227
string concat:? 5275
java class access:? 50757
total:? 189288
Results for JudoScript: bench.judo
Test Time (ms)
simple loop:? 29302
simple fxn:? 390743
simple fxn with arg:? 403152
simple fxn with local:? 618718
string concat:? 4617
total:? 1446532

-------------------------------------MiniScript + Feature----------------------------------

引入
import abc.ddd;
import java.util.Collections as CC;
CC.sort(...);


class Dog{
?name
?@Property address

?getName(){
??name+"tt";
?}

?abc(){
??println "ccccc";
?}
};

闭包Closure
sit={ name1,name2 -> println name1+name2+" Sit,Sit! Sit! Good dog"}
sit.call();

集合
aCollect = [5,9,2,4,5,6]

Map 映射
myMap = ["name" : "Groovy","date" : new Date()]
println myMap["date"]
println myMap.date


范围

myRange = 29...32
myInclusiveRange = 2..5
aRange = 'a'...'e'
for (i in aRange){
? println i
}
负索引
aList = ['python','ruby','groovy']
println aList[-1] // prints groovy
println aList[-3] // prints python
用范围分割
fullName = "Andrew James Glover"
mName = fullName[7...13]
print "middle name: " + mName // prints James
Ruby 风格的集合
collec = [1,3,5]
collec << 6 //appended 6 to collec

?

带有迭代器的闭包
[2,6,8,3].find { x |
???? if (x == 3){
?????? println x
???? }
}

javascript正则表达式
?var p=/^adfsdaf$/

字符内 ${变量}
println "My Lamp has a ${myLamp.baseColor} base"


Groovy 中的新语法
def nfile = ["c:/dev","newfile.txt"] as File
def val = ["http","www.vanwardtechnologies.com","/"] as URL
def ival = ["89.90"] as BigDecimal
println ival as Float
?


Groovy的switch语句能够处理各种类型的switch值
case值为类名,匹配switch值为类实例
case值为正则表达式,匹配switch值的字符串匹配该正则表达式
case值为集合,匹配switch值包含在集合中,包括ranges

?


---------------------
printMapClosure = { key,value -> println key + "=" + value }
[ "yue" : "wu","lane" : "burks","sudha" : "saseethiaseeleethialeselan" ].each(printMapClosure)
Produces:

yue=wu
lane=burks
sudha=saseethiaseeleethialeselan

fullString = ""
orderParts = ["BUY",200,"Hot Dogs","1"]
orderParts.each {
? fullString += it + " "
}

println fullString

synchronized n.旗语
semaphore?acquire?release


操作符重载
For example,a + b is the same as a.bopPlus(b).

MiniScript参考:Groovy 、?Sleep 、?ObjectScript 、Yoix、JBasic

GOOD Script: ?Groovy、ObjectScript、Rhino、Yoix(AT&T)

?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读