ceylon icon indicating copy to clipboard operation
ceylon copied to clipboard

support shortcut refinement of values as if they were functions

Open jvasileff opened this issue 9 years ago • 6 comments

The following valid code:

interface I {
    shared formal String() v;
}
class C() satisfies I {
    v() => "";
}

results in:

source/simple/run.ceylon:5: error: Ceylon backend error: incompatible types: String cannot be converted to Callable<? extends String>
    v() => "";
           ^
1 error

jvasileff avatar Aug 16 '16 04:08 jvasileff

I'm very surprised that this isn't working already.

gavinking avatar Aug 16 '16 12:08 gavinking

Well, I didn't even know the spec allowed this. Is I.v defined as a Value or a Function here?

FroMage avatar Aug 22 '16 13:08 FroMage

Well, I didn't even know the spec allowed this

I had no idea either; never thought to try it.

Is I.v defined as a Value or a Function here

v is Value, everywhere (I know this because I wound up creating a fake Function to help with parts of the Dart backend impl.)

jvasileff avatar Aug 22 '16 14:08 jvasileff

This requires changes in ClassTransformer.transformRefinementSpecifierStatement that are hard to write and test. IMO this is too much work to fix for 1.2.3 for too little value because it's never been used before. Moving to 1.3.

FroMage avatar Aug 22 '16 15:08 FroMage

Not for 1.3.1.

gavinking avatar Oct 17 '16 22:10 gavinking

Strange feature, do we even need it? :)

xkr47 avatar Sep 13 '18 18:09 xkr47