PROPOSAL: Lightweight Properties
schulz at e-Spirit.de
Fri Mar 6 02:07:14 PST 2009
> In effect the Property class becomes the generified Field
> object, so that
> problem is circumvented.
Well, the generified Field object should be returned by the reference, so that the generic type can be retrieved at compile-time, otherwise it would not make much sense. That's why the example uses the factory method at(<last part of the chain>), otherwise it will be difficult to have compile time type safety.
> The only thing it can not do is to check that the chain is
> correct (i.e in the
> example above that Foo#bar is a Bar( at compile time. When the
> PropertyBuilding is building the Property it can, but that
> is a little later
> than I would like - but still a great improvement on
> evalutation time, added
> to which the chained case is a minority case.
You are right. I forgot about the correctness of the chain. And this will only be possible by a new notation.
> My only question concerns annotations. It is important that
> the Field object
> is the real one, and not a synthetic partial copy. The
> reason for this is
> so that I can access Annotations. If this will work then I am happy.
I don't understand this one. You won't annotate the Field class but the field, so the object returned will have to support Annotation retrieval, I guess.
> So if FCM is going to be in -7 then my proposal is
> unnecessary. But of course
> that makes an assumption and unless I have missed something it seemed
> to be as far off as Property support.
FCM won't. But maybe a proposal for Field-Literals might have a chance, as it seems a coin to me. Not much magic about it, I think. But then again, I might miss the hard parts as I have no real insight into javac etc.
@Joe: Would it make sense to file a proposal on Field-Literals or would it be doomed right away? And I am not sure, whether completing such a proposal by Method- and Constructor-Literals would become too big for Coin. Any hint?
Further, I am not sure, how elaborate I could do it by myself, too, so any coop is welcome.
Sorry, for getting off topic.
More information about the coin-dev