Wrapper generation for agent calls

by Colin Adams (modified: 2007 Apr 26)

I have recently become irritated by having to code dummy arguments for routines to be used as agents. Eric Bezault suggests that Eiffel could be usefully extended to eliminate the need for this.

So I have sketched a proposal here

Comments
  • Patrick Ruckstuhl (10 years ago 26/4/2007)

    Interesting

    That look's quite interesting, especially with GUI there are quite a lot of those wrappers and I think this would be a good way to simplify things.

    • Franck Arnaud (10 years ago 30/4/2007)

      sometimes it's just a rubbish API

      I'm not sure GUIs require a lot of these wrappers more than anything else, given a proper API. The poster child of wrapper agent in UI is the 'button clicked' usage pattern in EiffelVision where you have to give an agent taking 1827 parameters which are irrelevant to a button click. The correct API should take a parameterless procedure agent -- this is not incompatible with also having a fine grained API with more info for more sophisticated usage pattern of the mouse events, indeed the simple case can be implemented with a wrapper agent, but once and inside EiffelVision, rather than a lot everywhere in client ccode.

      This does ring an alarm bell when the motivation for a language change is a defect in a library that can easily be fixed in the existing language, though I guess there remains some defensible use cases for dealing with wrapper agents.

  • Bertrand Meyer (10 years ago 26/4/2007)

    Something like this may be needed, but there's inline agents

    I agree that something like this would make life easier; many people have noted that the plain ? works only if you keep arguments in the order of the original.

    I tend to like the ?n notation; the only immediate concern, barring further analysis, is that the semantics of the plain ? is not so obvious any more.

    I think you can achieve the result almost as simply with inline agents, so I am not sure how critical this is. But it's definitely worth exploring.