Difference between revisions of "Talk:Agent wrapper generation"
Colin-adams (Talk | contribs) |
Colin-adams (Talk | contribs) (Dropping arguments) |
||
(One intermediate revision by one other user not shown) | |||
Line 10: | Line 10: | ||
Also I don't see the reason why you need a special syntax to drop arguments. If you want an agent which does not get any arguments, you just provide a feature which doesn't take any. As long as you provide a feature which takes a number of arguments, all of them will be open since you cannot pass ''nothing'' in this spot. You can always close arguments if you have a reasonable default value which you can pass. | Also I don't see the reason why you need a special syntax to drop arguments. If you want an agent which does not get any arguments, you just provide a feature which doesn't take any. As long as you provide a feature which takes a number of arguments, all of them will be open since you cannot pass ''nothing'' in this spot. You can always close arguments if you have a reasonable default value which you can pass. | ||
+ | |||
+ | |||
+ | '''--Colin (could you please add your signature so it is clear who said what)''' | ||
The type for <eiffel>agent notify_button (?3)</eiffel> is <eiffel>PROCEDURE [ANY, TUPLE [INTEGER]]</eiffel>. | The type for <eiffel>agent notify_button (?3)</eiffel> is <eiffel>PROCEDURE [ANY, TUPLE [INTEGER]]</eiffel>. | ||
The point is for the compiler to generate a wrapper to intercede between the two types. | The point is for the compiler to generate a wrapper to intercede between the two types. | ||
+ | |||
+ | == Dropping arguments == | ||
+ | |||
+ | --[[User:Colin-adams|Colin-adams]] 08:10, 28 April 2007 (CEST)The reason for syntax to drop all arguments is currently that providing no arguments signals an agent that accepts all the open arguments an no other. | ||
+ | |||
+ | I suppose the compiler could also check to see if the specified agent receives zero arguments, and generate a wrapper there too. | ||
+ | And this can be extended to only consider the situation after all closed arguments have been taken into account. |
Latest revision as of 21:10, 27 April 2007
--Juliant 21:17, 27 April 2007 (CEST)
You can already now use the target as an open argument. If you define your agent as agent {AEROPLANE}.refuel
than this agent has the target as first open argument. What you cannot do at the moment is having the target at another position than the first, so an example with agent {A_TYPE}(?2).a_feature (?1)
might make more sense.
One problem you have with only caring for a part of the arguments is the conformance rules for generics which are applied to agents as well. If you define your agent as agent notify_button_press (?3)
(which is my favorite syntax untill now) then what is the type of this agent? It has to be something like PROCEDURE [ANY, TUPLE [*, *, INTEGER]]
, but then it won't conform to the event handler you have given since the argument tuple does not have enough elements. This is a problem with the conformance of tuples which is not correctly applicable to agents.
See this paper for more information. The problem with the paper is that they don't reason about open targets which have to be handled differently than open arguments.
--Juliant 23:30, 27 April 2007 (CEST)
Also I don't see the reason why you need a special syntax to drop arguments. If you want an agent which does not get any arguments, you just provide a feature which doesn't take any. As long as you provide a feature which takes a number of arguments, all of them will be open since you cannot pass nothing in this spot. You can always close arguments if you have a reasonable default value which you can pass.
--Colin (could you please add your signature so it is clear who said what)
The type for agent notify_button (?3)
is PROCEDURE [ANY, TUPLE [INTEGER]]
.
The point is for the compiler to generate a wrapper to intercede between the two types.
Dropping arguments
--Colin-adams 08:10, 28 April 2007 (CEST)The reason for syntax to drop all arguments is currently that providing no arguments signals an agent that accepts all the open arguments an no other.
I suppose the compiler could also check to see if the specified agent receives zero arguments, and generate a wrapper there too. And this can be extended to only consider the situation after all closed arguments have been taken into account.