基于 JVM 的编程语言 Coteline

码农软件 · 软件分类 · 脚本编程语言 · 2019-03-04 22:14:20

软件介绍

Coteline 是一个全新的基于 JVM 的编程语言。Coteline 是 Ceylon 的超集,并保持对 Ceylon 的向后兼容。

比 Ceylon 改进的地方包括:

  • "public as a service", because shared is not a good keyword.

  • implements, because it is fancier than satisfies and it          closes the gap for existing J2EE 1.3 developers.

  • Call an object a singleton.

  • Use const in lieu of value.

  • Write def as a Hipster-compliant variant of function.

  • Ink Unit instead of void in your fine-crafted Coteline           definitions.

  • contract and trait carry more meaning than          interface (and who cares about the actual formal semantics of these?).

  • We think pray is a better replacement for assert, because          this is what you actually do when you write assertions.

  • dynamic blocks are better named as unsafe blocks, because they          escape the wonderland of static type checks.

  • Parametric types with in / out for contravariance and covariance are hard          to manipulate. This is also way too reminiscent of the C# world. Coteline          provides salvation with covar and contravar.

  • Last but not least, you can also write foreach loops in Coteline.

示例代码:

"The classic Hello World program"
public Unit hello(String name = "World") {
    const str = "Hello, `` name ``!";
    def work() => print(str);
    work();
    pray(1 == 1);
    plop.plop();
    foreach (i in {1, 2, 3}) {
        print(i);
    }
}

singleton plop {
    public Unit plop() {
        print("Oh Plop!");
    }
}

"Run the module `better.ceylon.is.coteline`."
public Unit run(){
    if (nonempty args=process.arguments) {
        foreach (arg in args) {
            hello(arg);
        }
    }
    else {
        hello();
    }
}

本文地址:https://codercto.com/soft/d/642.html

算法神探

算法神探

[美] 杰瑞米·库比卡 / 啊哈磊、李嘉浩 / 电子工业出版社 / 2017-2 / 65

《算法神探:一部谷歌首席工程师写的CS小说》围绕程序设计典型算法,精心编织了一个扣人心弦又趣味横生的侦探缉凶故事。小说主人公运用高超的搜索技巧和精深的算法知识,最终识破阴谋、缉拿元凶。其间,用二分搜索搜查走私船、用搜索树跟踪间谍、用深度优先搜索逃离监狱、用优先队列开锁及用最佳优先搜索追寻线索等跌宕起伏又富含算法精要的情节,让读者在愉悦的沉浸式体验中快速提升境界,加深对程序世界的理解。《算法神探:一......一起来看看 《算法神探》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具