JVM 语言的探索发现

又在 WIKI 上溜达了一下 https://en.wikipedia.org/wiki/List_of_JVM_languages,有一些新的发现:

ColdFusion Markup Language (CFML), 和设想的 https://www.cnblogs.com/inshua/p/17434305.html 相似

Ballerina,开始有点震惊,有一部分和我的构想相似,但是看了看细节,凑合吧,让人惊叹的是完成度很高。例如

这个语言甚至支持对 RESTful 请求的 Literal,很有意思。

为什么说凑合呢?例如它号称支持消息队列,怎么支持的呢?

// https://central.ballerina.io/ballerinax/kafka  
kafka:ConsumerConfiguration consumerConfiguration = {
    groupId: "group-id",
    topics: ["kafka-topic-1"],
    pollingInterval: 1,
    autoCommit: false
};

listener kafka:Listener kafkaListener = new (kafka:DEFAULT_URL, consumerConfiguration);

service on kafkaListener {
    remote function onConsumerRecord(kafka:Caller caller, kafka:ConsumerRecord[] records) {
        // processes the records
        ...
        // commits the offsets manually
        kafka:Error? commitResult = caller->commit();

        if commitResult is kafka:Error {
            log:printError("Error occurred while committing the offsets for the consumer ", 'error = commitResult);
        }
    }
}

对 rabbitmq 的也类似,https://central.ballerina.io/ballerinax/rabbitmq 。并没有纳入语言本身进行思考。

另外,没想到 Benshell 的实现和我的 VBAInterpreter 非常相似。https://github.com/beanshell/beanshell/blob/master/src/main/java/bsh/BSHBlock.java#L93C48-L93C48

class BSHBlock extends SimpleNode {
    .... ....
    public Object eval( CallStack callstack, Interpreter interpreter,
            Boolean overrideNamespace ) throws EvalError {

        if ( isSynchronized ) {
            // First node is the expression on which to sync
            Node exp = jjtGetChild(0);
            Object syncValue = exp.eval(callstack, interpreter);
            synchronized( syncValue ) { // Do the actual synchronization
                return evalBlock(
                    callstack, interpreter, overrideNamespace, null/*filter*/);
            }
        }
        return evalBlock(
                callstack, interpreter, overrideNamespace, null/*filter*/);
    }
posted @ 2023-09-07 16:41  Inshua  阅读(2)  评论(0编辑  收藏  举报