>>> Either way, you have to put logic somewhere that tries to figure out
>>> what the heck you want to borrow and then figure out where the heck to
>>> get it.
>>
>> If it is done at compile time you don't need "messaging" logic. It
>> would be uniquely defined what you can get.
>
> Please explain.

Think about object hierarchy. It is uniquely defined what method
overrides what etc.

So it would just expand the same idea to "membership dimensions" in
addition to "inheritance dimensions".

I mean that assuming man has a bag would work effectively similar to
man extends bag at compile time.

If bag has a getter then man can expose that getter. However, if we
would really extend bag then we are stuck with it (and we could'nt
have man wear both jacket, trousers and bag at same time).

When man only "has" bag then we can also change the bag and extend the
bag with another bag or set it to null even.

Nevertheless, we could annotate:

@DefaultExpose(ExposeLevels.ALL)
public class Man {
 private Bag bag;
}

public class Customs {
   public boolean investigate(Man man) {
      Pencil = man.getPencil();
   }
}

:::: Alternatively you can move the annotation

public class Man {
 @DefaultExpose(ExposeLevels.ALL)
 private Bag bag;
}

::: or even more detailed:

public class Bag {
 @DefaultExpose(ExposeLevels.ALL)
 private PencilCase pencilCase;
}


Override rules could be same as "as if" the Man extended Bag and as if
Bag extened PencilCase.

**
Martin

Reply via email to