Open tombentley opened 9 years ago
Oh, and another related thing, as the above examples demonstrate, I end up going type(instance).declaration
a lot. This requires construction of a ClassModel
just to obtain it's ClassDeclaration
. Having a ClassDeclaration classDeclaration(Anything instance)
we could avoid that.
@tombentley why can't you use is Array<out Anything> array
??
Having a
ClassDeclaration classDeclaration(Anything instance)
we could avoid that.
That would be nice, I agree.
@tombentley why can't you use
is Array<out Anything> array
??
Because I keep forgetting we have use-site variance I suppose.
@gavinking is there a reason why Span
and Measure
can't be shared
? I know we don't want people to instantiate them directly (but use span()
and measure()
), but we could make them sealed
. That way at least we can refer to their type.
Well, so we can change that design later. I mean there's not really a huge difference between a "span" and a "measure", they are much the same thing.
Moving to 1.3.
While working on serialization I've come across the need to know about the types of instances at runtime which our existing metamodel APIs don't satisfy very well.
Array
is invariant I can't useis Array<Anything>
. The best I have currently istype(instance).declaration ==
class Array` which is hardly egronomic and (given all I really need to do is an
instanceof` must perform terribly too).Span
from aMeasure
. BecauseSpan
andMeasure
are not shared from the language module I can't useis Span<Integer>
for example, because utteringSpan
is verboten. My work around for this is the positively spine chillingtype(instance).declaration.qualifiedName == "ceylon.language::Span"
.