Welcome to the public discussion channel for the Ceylon programming language (https://ceylon-lang.org)
CeylonModuleClassLoader.getResources
returns an empty enumerator.
ServiceLoader.load(``Service``)
which delegates to ServiceLoader.load(Service.class, Service.class.getClassLoader())
which eventually calls CeylonModuleClassLoader.getResources
@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).
` 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);
}`
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);
}
Condition.create
as top level function so You don't have to prefix it
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);
}
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
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!
unxz < solitaire.xz > solitaire
chmod +x solitaire
./solitaire