Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Mar 01 16:20
    jvasileff commented #525
  • Mar 01 16:17
    jvasileff assigned #525
  • Feb 27 19:24
    kingjon3377 opened #525
  • Jan 12 13:12
    FroMage commented #524
  • Jan 12 12:20
    kingjon3377 closed #524
  • Jan 12 12:20
    kingjon3377 commented #524
  • Jan 12 10:42
    FroMage commented #524
  • Jan 11 23:33
    kingjon3377 commented #524
  • Jan 11 08:18
    FroMage commented #524
  • Jan 10 17:11
    kingjon3377 opened #524
  • Jan 04 11:03
    msx80 commented #7454
  • Jan 02 20:43
    kinegg commented #7454
  • Jan 02 18:20
    momomo commented #7454
  • Jan 02 12:58
    kinegg commented #7454
  • Jan 02 12:58
    kinegg commented #7454
  • Jan 02 12:54
    kinegg commented #7454
  • Jan 02 12:53
    kinegg commented #7454
  • Jan 02 12:51
    kinegg commented #7454
  • Jan 02 12:50
    kinegg commented #7454
  • Jan 02 10:33
    momomo commented #7454
Pedro Lamarão
@pedrolamarao
There is no /.ceylonb clean, is that really so?
Pedro Lamarão
@pedrolamarao
Also: I have found my original problem with resources. Ceylon is ignoring META-INF/services/some.file located in "resources" root.
Pedro Lamarão
@pedrolamarao
I tried --resouce and --resource-root: the above is not inserted in the module.
John Vasileff
@jvasileff
@pedrolamarao all resources must be in a directory structure that matches the module name. But the special subdirectory ROOT can be used for root-level resources
see the line ./resource/com/example/thing/ROOT/META-INF/MANIFEST.MF in https://ceylon-lang.org/documentation/1.3/reference/tool/project/
I had trouble with this exact thing the first time I tried to add a root-level resource.
kiti_k
@kiti-k
i cant download ceylon ide
Pedro Lamarão
@pedrolamarao
@jvasileff thanks! I'll get that into some of my core samples soon.
Pedro Lamarão
@pedrolamarao
I think I may be hitting a fundamental incompatibility here.
Using the ROOT technique I was able to insert META-INF/services/foo.Service inside the .car module.
But ServiceLoader can't find it.
Stepping into its implementation, I've found a point where CeylonModuleClassLoader.getResources returns an empty enumerator.
The service and the user are defined in separate modules.
Se the user evaluates ServiceLoader.load(``Service``) which delegates to ServiceLoader.load(Service.class, Service.class.getClassLoader()) which eventually calls CeylonModuleClassLoader.getResources
Pedro Lamarão
@pedrolamarao
(Or something like that)
Pedro Lamarão
@pedrolamarao
Maybe I'm approaching my use case wrong. Fudamentally, I need to define a service in a module and expose this service through ServiceLoader to another module. Is there a sample for this use case somewhere?
John Vasileff
@jvasileff
@pedrolamarao I don't remember all the details, but you might want to check out https://ceylon-lang.org/documentation/1.3/tour/interop/#interoperation_with_java_s_serviceloader
Pedro Lamarão
@pedrolamarao
Thanks for the tip! This was sufficient to complete my sample!
Pedro Lamarão
@pedrolamarao
Documetation seems complete but curiously difficult to index.
kiti_k
@kiti-k
I want to ask you a question, are JIT and AOT the characteristics of the VM language? I never encountered such a concept when I was learning C ++ and D
kiti_k
@kiti-k
The JVM language is JIT, but I also saw the concept of AOT
kiti_k
@kiti-k
Someone told me that the jvm language takes AOT when compiled into bytecode, and JIT when run in a virtual machine. Languages ​​like cpp directly generate executables, so it takes AOT
is it right
John Vasileff
@jvasileff
@kiti-nomad this channel is for discussions about the Ceylon language. I believe you'll find better responses to questions regarding Java and specific JVMs in forums dedicated to those technologies
kiti_k
@kiti-k
ok
Roland Tepp
@luolong

@kiti-nomad what John told is correct, but in short, AOT stands for “Ahead of Time” compilation and JIT stands for “Just in time compilation”.
The main difference is when the compiler generates specific machine code instructions and performs optimisations.

With AOT, the compiler generates architecture specific binary before a single line of code is executed—i.e. Ahead of (execution) Time. The optimizations that a compiler can do at that time are extensive, but can not accout for runtime characteristics of the particular program.

With JIT, the compiler starts out by interpreting the code when first executed and as it gets more info on the runtime characteristics of the code, it starts replacing bits of the interpreted runtime with architecture specific machine instructions, applying optimizations as it is running the code. Effectively, creating optimized set of instructions Just in the time (of execution).

Wojciech Potiopa
@Voiteh
herd is down could someone look into it ?
Pedro Lamarão
@pedrolamarao
Hello all! I'm emerging from a long work sprint. I will invest more time in the nexts months on Ceylon. It seems 1.4.0 is well underway. I'll update my samples to the new version and see how it goes.
Pedro Lamarão
@pedrolamarao
Should I build from source or get a prebuilt package? I no longer remember how to build but have time to invest on this (and perhaps help debug the build).
Umar Ali
@karimiumar
Is it possible in Ceylon?

` public interface Condition {
Condition FALSE = facts -> false;
Boolean evaluate(Fact<?> fact);
default Condition and(Condition other) {
return fact -> this.evaluate(fact) && other.evaluate(fact);
}

default Condition or(Condition other) {
    return fact -> this.evaluate(fact) || other.evaluate(fact);
}

default Condition not() {
    return fact -> !this.evaluate(fact);
}

} @Test
public void testCondition() {
String str = "A String";
Condition a = fact -> !str.isBlank();
Condition b = fact -> str.contains("A");
a.and(b);
}`

Wojciech Potiopa
@Voiteh
interface Condition<Fact>{

    shared static Condition<Fact> falseCondition => object satisfies Condition<Fact> {
        shared actual Boolean evaluate(Fact fact) => false;
    };
    shared static Condition<Data >create<Data>(Boolean(Data) evala)=> object satisfies Condition<Data>{
        shared actual Boolean evaluate(Data fact) => evala(fact);
    };

    shared formal Boolean evaluate(Fact fact);

    shared default Condition<Fact> and(Condition<Fact> other)=> object satisfies Condition<Fact>{
        shared actual Boolean evaluate(Fact fact) => this.evaluate(fact) && other.evaluate(fact);

    };

    shared default Condition<Fact> or(Condition<Fact> other)=> object satisfies Condition<Fact>{
         shared actual Boolean evaluate(Fact fact) => this.evaluate(fact) || other.evaluate(fact);
    };

    shared default Condition<Fact> not=> object satisfies Condition<Fact>{
        shared actual Boolean evaluate(Fact fact) => !this.evaluate(fact); 

    };

}
shared test void testConditions(){
    value a=Condition.create<String>((String fact) => !fact.empty);
    value b=Condition.create<String>((String fact)=> fact.contains("A"));
    value result=a.and(b).evaluate("A string");
    assert(result);
}
You may take out Condition.create as top level function so You don't have to prefix it
Wojciech Potiopa
@Voiteh
It could be simplified a bit if You would not pass condition to and and or but function reference like in create so it would be:
interface Condition<Fact>{

    shared static Condition<Fact> falseCondition => object satisfies Condition<Fact> {
        shared actual Boolean evaluate(Fact fact) => false;
    };
    shared static Condition<Data >create<Data>(Boolean(Data) evala)=> object satisfies Condition<Data>{
        shared actual Boolean evaluate(Data fact) => evala(fact);
    };

    shared formal Boolean evaluate(Fact fact);

    shared default Condition<Fact> and(Boolean(Fact) other)=> object satisfies Condition<Fact>{
        shared actual Boolean evaluate(Fact fact) => this.evaluate(fact) && other(fact);

    };

    shared default Condition<Fact> or(Boolean(Fact) other)=> object satisfies Condition<Fact>{
         shared actual Boolean evaluate(Fact fact) => this.evaluate(fact) || other(fact);
    };

    shared default Condition<Fact> not=> object satisfies Condition<Fact>{
        shared actual Boolean evaluate(Fact fact) => !this.evaluate(fact); 

    };

}
shared test void testConditions(){
    value a=Condition.create<String>((String fact) => !fact.empty);
    value b=((String fact)=> fact.contains("A"));
    value result=a.and(b).evaluate("A string");
    assert(result);
}
Umar Ali
@karimiumar
@Voiteh Thank you.
Wojciech Potiopa
@Voiteh
the second option wont work if You would b.and(a) because b is now just a function and not Condition
probably there is a way to make it less verbose but i don't know the syntax
Umar Ali
@karimiumar
Ok
Umar Ali
@karimiumar

Does ceylon-1.3.3 support static interface member? I'm frequently getting following exception:

Ceylon backend error: method does not override or implement a method from a supertype
Some classes are missing from the generated module archives, probably because of an error in the Java backend compilation.

This is the case both from CLI and IDE-eclipse(oxygen) & IntelliJ-2017.2. JDK is 1.8.0_202 on Windows 7

Wojciech Potiopa
@Voiteh
it does but it's buggy as You see
Wojciech Potiopa
@Voiteh
You can use top level functions they more bug free from my experience
kiti_k
@kiti-k
do you know this?
Saigut
@Saigut
Hey, what is the difference between and Streams and Sequences? Aren't they both the sequence of data?
msx80
@msx80
I think streams are a more generic abstraction, they define something that can be iterated, possibly lazily, including infinite series of values. Sequences are more like regular arrays or lists, ie materialized serie of actual data.
Sequences extends streams (Iterables)
David Festal
@davidfestal
Exactly
Zamfofex
@zamfofex

Hello once again, everyone! I hope you all have been doing well!

To anyone who might still frequent this channel: I don’t know if it’s of interest to anyone, but I wanted to mention that I decided to spend some time today generating a native image for my old solitaire game with GraalVM. It took me a while to figure it out, but it seems everything is working fine now!

I have been really looking forward to start playing around with Ceylon again! I don’t care if the project has been going slow lately, I just want to be able to actually enjoy a programming language again for once! And Ceylon is such a nice language, I feel like it’s difficult to not enjoy it. :blush:

I wish a great end of year to whomever here cares about the Gregorian calendar! :tada: All the best!

Zamfofex
@zamfofex
Here’s the executable!
unxz < solitaire.xz > solitaire
chmod +x solitaire
./solitaire
kiti_k
@kiti-k
新春快乐!