--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/etPan.5593b49c.ded7263.11a%40juliens-mbp-2.
For more options, visit https://groups.google.com/d/optout.
shared abstract class Foo() {
shared formal Anything(String) method;
}
shared class Bar() extends Foo() {
void method_impl([String]|[String, Integer] args) {
print("called with ``args``");
}
shared actual Anything(*<[String]|[String, Integer]>) method = flatten(method_impl);
}
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/CAP7PoCdoOCCQXkrPdiBdx3p44Z2qSnHxWhLDdB5brWQSSrJZ4g%40mail.gmail.com.
--
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/CAGwh2kpJo6O5imSHAAMn0N99GxazOJuBEGHfFP135aV5HerxCg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/etPan.559a45fc.2eb141f2.109%40juliens-mbp-2.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/CAOJRyvqzSOBU-zdMv0AaBT0juuR5zeFE8PaCZyK-LapvR0yd2Q%40mail.gmail.com.
On 6 Jul 2015 at 17:14:38, John Vasileff (jo...@vasileff.com) wrote:
I was going to try to explore/demo a potential shadowing issue with this. But then I hit a compile error:
classOptions(shareddefault Stringabc) {}classOptionsExt(Stringabc) extendsOptions(abc) {}classOptionsExtExt() extendsOptionsExt("initial") {
// May not inherit two declarations with the same name// that do not share a common supertype: abc is defined// by supertypes OptionsExtExt and Options
shared actualvariable Stringabc = "initial";}
Is it right that this code is illegal? The `abc` in `OptionsExt` seems to be caught between being a value local to the initializer section and an attribute of the class.The shadowing issue can be seen in the simpler example below that does compile, where `abc` in `OptionsExt` refers to the init parameter, not the class attribute:classOptions(shareddefault variableStringabc) {}classOptionsExt(Stringabc) extendsOptions(abc) {shared String oeABC => abc;}sharedvoidtestOEE() {value oe = OptionsExt("initial");oe.abc = "new";print(oe.abc); // newprint(oe.oeABC); // initial}So it may be safer to use constructors in the subclasses rather than initialization parameter lists.Now, if we dig a bit deeper, the `abc` identifier in `OptionsExt` seems to act locally as if it refines (not shadows) `Options.abc` as can be seen when printing `oeABCThis`, but the "refinement" is hidden from subclasses, as can be seen when printing “oeeABCThis” and “oeeABCSuper”:
classOptions(shareddefault variableStringabc) {}classOptionsExt(Stringabc) extendsOptions(abc) {shared String oeABCThis => this.abc;shared String oeABCSuper => super.abc;}classOptionsExtExt(Stringx) extendsOptionsExt(x) {shared String oeeABCThis => this.abc;shared String oeeABCSuper => super.abc;}sharedvoidtestOEE() {
valueoe = OptionsExtExt("initial");
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/690E16D4-4923-4CBD-99FB-1AB122D40BF5%40vasileff.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/etPan.559ad7b3.3352255a.109%40juliens-mbp-2.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/CAP7PoCdrxUh00qgSjSU55JJQFKPbH8_DHrKRoqzCB0ygizXyhg%40mail.gmail.com.
shared class Foo() {
shared variable Foo? ref = null;
shared Foo method_impl() {
assert(exists a = ref);
return a;
}
shared Foo() method = method_impl;
}
Foo makeFoo() {
Foo foo = Foo();
foo.ref = foo;
return foo;
}
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/etPan.559fc926.515f007c.10d%40juliens-mbp-2.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/559FFF14.8050909%40googlemail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/559FFF14.8050909%40googlemail.com.
On 11 Jul 2015 at 08:02:48, John Vasileff (jo...@vasileff.com) wrote:
You can recover most of the performance cost with a memo. Although I guess there could be a thread safety issue.
class TestC() {variableTestC(*<[String]>)? fluentMethodMemo = null;TestCfluentMethod_impl([String] args) {
return this;}shared TestC(*<[String]>) fluentMethod
=> fluentMethodMemoelse (fluentMethodMemo = flatten(fluentMethod_impl));}
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/A146ED7F-779E-4587-8A59-AD0900E907E3%40vasileff.com.
On 1 Jul 2015 at 12:36:56, Gavin King (gavin...@gmail.com) wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/CAP7PoCdoOCCQXkrPdiBdx3p44Z2qSnHxWhLDdB5brWQSSrJZ4g%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/etPan.55af539d.7fdcc233.8c0%40juliens-mbp-2.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/CAKU9E9vAreEUXTu9hczX6diWahw%2B3EgZFmZkvvUTVX%2Bb4DL%2BNw%40mail.gmail.com.
class A() {
shared default void foo(String s) {}
}
class B() extends A() {
shared actual default void foo(String|Integer s) {}
}
Note: in a future release of the language, we would like to support contravariant refinement of method parameter types.I assume it’s because the JVM doesn’t support it, so it would be difficult to do on the JVM backend.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/etPan.55af7061.3f2dba31.8c0%40juliens-mbp-2.
On 22 Jul 2015 at 10:28:07, Stephane Epardaud (stephane...@gmail.com) wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/CAKU9E9vAreEUXTu9hczX6diWahw%2B3EgZFmZkvvUTVX%2Bb4DL%2BNw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/55AF7105.10906%40googlemail.com.
shared class Message<out T>() {
shared T msg => nothing;
}
shared void consumer(Anything(Message<Nothing>) handler) {}
void test1() {
consumer((Message<String> msg) => print(msg));
}
shared class Future<in T>() {
shared void complete(T val) {}
}
shared void resolve(Anything(Future<Object>) handler) {}
void test2() {
resolve((Future<String> fut) => print(fut));
}
On 29 Jul 2015 at 12:33:16, Gavin King (gavin...@gmail.com) wrote:
--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-dev/55B8C050.30501%40googlemail.com.