Open FroMage opened 11 years ago
I don't feel that a specialized feature like annotations needs to have a syntax that is "as short as possible". Especially because annotations by themselves don't do anything, you'll always have to have some meta model handling in your code.
Now if we can come up with something nice I'm not going to be against it of course, but maybe a future implementation of "anonymous classes" could already help out a bit, eg:
shared annotation Annot annot() => class () satisfies Annotation<Annot> {}
Also, maybe marking something (Annot
) with annotation
could already by default imply satisfies Annotation<Annot>
? Giving you:
import ceylon.language.model { Annotation }
shared annotation final class Annot() {}
shared annotation Annot annot() => Annot();
and the (theoretical) short form of:
shared annotation Annot annot() => class () {}
That isn't so bad, is it?
"anonymous classes" could already help out a bit
But if the annotation class is anonymous, how can it be obtained at runtime?
maybe marking something (
Annot
) withannotation
could already by default implysatisfies Annotation<Annot>
Wow, so now the presence of an annotation can affect the satisfies
clause? I don't think that's a good idea at all.
This is for 1.1, no need to rush for a solution ;)
Wow, so now the presence of an annotation can affect the
satisfies
clause?
Well, in fairness, Java's constructs like enum
and @interface
work exactly that way. I don't see why it being an annotation means we could not do the same thing.
This is for 1.1, no need to rush for a solution ;)
No. It's for 1.2 (if ever).
Right, but I didn't find that milestone yet ;)
Looks like this one was closed by accident.
Compare:
With:
We need to seriously consider how to make it easier for people to write annotations.