ceylon

    2热度

    1回答

    我试图实现类DistanceCM和DistanceMM,我希望它们可以互换,只要它们都从Distance继承。 不过,我得到这个错误: "Error:(46, 76) ceylon: type parameter 'Other' of declaration 'Summable' has argument 'Distance' which is not assignable to upper bo

    1热度

    1回答

    标题是我的问题。具体来说,匹配元组中的值时,通配符很重要。 在OCaml中它是可能的: match x with (3, _) -> 5 | (_, 4) -> 7 | (4, 5) -> 6;; A '开关' contruct,其允许对元组值匹配不带通配符是没有用的。在锡兰,我认为交换机坏了;-)。

    1热度

    1回答

    正常情况下,锡兰喜欢当一个文件名与在该文件中声明的(唯一)类的名称相对应。 当我尝试按照与顶级函数相同的模式时,IDE向我咆哮。例如: 文件结构: utils的/ 文件/ 的package.json stringFromFile.ceylon module.ceylon package.ceylon 文件stringFromFile.ceylon的含量: String|Null stringFro

    3热度

    2回答

    我在增加一个变量整数时遇到了一些麻烦。此代码: variable Integer myInteger = -1; Integer getInteger() { myInteger = myInteger + 1; print("myInteger: " + myInteger.string); return Integer(myInteger); } Arra

    1热度

    1回答

    无论何时测试函数(包含test注解的函数)包含失败的断言,断言与抛出异常时的效果相同:将不会执行该函数中的其他代码行。因此,在用'test'注释的函数中断言语句就像普通的Ceylon函数中的普通断言语句一样工作。这runs contrary to the documentation,它声明普通的断言语句可以用于进行单元测试。 因此,运行下面的代码,我能看到的声明myTests1但不'myTests

    5热度

    1回答

    我想从包装类外部实例化一个内部非静态接口。 这可能吗? 考虑下面的代码: shared class AOuterClass() { Integer val = 3; shared interface AInterface { shared Integer val => outer.val; } } void test() { AOuterClass o =

    0热度

    2回答

    我想在/为锡兰编写一个RMI库(因为我还没有找到一个)。 我需要的第一件事就是代理。在java中我用类似 Proxy.newProxyInstance(classLoader, interfaces, handler); 有什么等同于锡兰? (还没有找到的东西) 尝试写这样的事情我自己,我碰到这个solution for the jvm使用字节码操作。 漂亮,正是我想要的。 请注意,这甚至可以

    1热度

    1回答

    我选择把我的小项目的代码放在'default'模块(在/source/main.ceylon文件中),但是我在哪里放置我的模块描述符? 目前我在/source/module.ceylon 中使用它,但是当鼠标放在模块名称上时,它给了我一个可怕的警告“在根源目录中遇到的模块描述符”。 我需要有一个模块描述符,因为我需要依赖一个锡兰模块上(httpd)

    2热度

    1回答

    我正在试着制作一个简单的应用程序,它利用了ceylon.http.server,ceylon.json,ceylon.io模块。 当我编译,我得到这些错误: Error:(4, 8) ceylon: source code imports two different versions of module 'com.redhat.ceylon.langtools.classfile': versio

    1热度

    2回答

    我有一个枚举抽象类的类型: shared abstract class Foo() of bar|baz {} 并试图检查是否Foo的功能是不是bar: shared void test(Foo foo) { if (!is bar foo) { } } 我得到的错误 incorrect syntax: no viable alternative at token