On 8/8/06, Yuval Kogman <[EMAIL PROTECTED]> wrote:
I personally prefer delegates for almost any design dillema, but most CPAN modules aren't that way.
Well, what way are they? How else has this problem been solved?
<snipped stuff about adaptors> Yes, this is necessary for anything heavyweight and probably better design, but again, hard to encourage on a wide scale.
Yeah, thinking in terms of delegates takes a little brain training. I wish there were a simpler way. Every time I tried to add views to the object model, I found immense amounts of complexity lurking. As an example, say you declared the default header method as the one in SomeOtherAPI as you mentioned above. If a function declares a parameter as a SomeAPI and then passes it on to a helper function, which leaves it untyped, which then calls header, what happens? Since your proposal is lexical, SomeOtherAPI's is called, which is probably not what was intended. So now to refactor, you have to restate your types. Also, any time you use objects through role interfaces, you have to type those parameters lest somebody weak-role their object in a way disfavorable to your code. If delegates are the right answer but not approachable, presumably we're looking for a *simpler* solution to this problem. I don't think this is it. Luke