S
S Perryman
Mike said:Robert Martin wrote:
It would also be trivial for an IDE to generate the delegation methods
for you, and no languages changes are required for that.
The big problem with delegation is correctness (safety specifically) :
type T
{
Delegate D ;
op() ;
}
T:p() = D.op() ;
Delegating service execution to some other object(s) D, would require
that D cannot be messed with (re-assigned, deleted etc) .
With heap-based object allocation, such guarantees become difficult.
With prog langs that can 'embed' a D into the representation of T (C++ ,
the "expanded" concept in Eiffel etc) , delegation is safer.
Regards,
Steven Perryman