MiniScript脚本语言扩展

MiniScript脚本语言扩展,第1张

概述脚本语言 个人评价 说明 Groovy +++ Jython / python的java实现 Rhino ++ javascript的java实现 JudoScript - Beanshell + Jess / Jelly / BeanScriptingFramework / Tcl/Java / JRuby / Ruby的java实现 Pnuts / ObjectScript +++ Seppi
脚本语言 个人评价 说明
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)

  总结

以上是内存溢出为你收集整理的MiniScript脚本语言扩展全部内容,希望文章能够帮你解决MiniScript脚本语言扩展所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1268874.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-08
下一篇 2022-06-08

发表评论

登录后才能评论

评论列表(0条)

保存