Monday, January 9, 2012

Agent calls passing a tuple entity

Starting from https://github.com/LibertyEiffel/Liberty/commit/1083bfb74cad52813278e1d451d6089efc68ec46 a long-standing limitation of SmartEiffel is removed.

SmartEiffel used to require a manifest tuple for both call and item agent features. The rationale is to force the user to ponder on the number of arguments; and since no actual tuple was created, memory was not wasted.
The drawback is that one had to manually "decapsulate" a provided tuple using an explicit (and ugly) [a_tuple.item_1, a_tuple.item_2]

Now one may call an agent using a variable that contains a tuple.

The only condition is that the entity is correctly statically typed, because the compiler generates calls to the item_i features using the static type. Thus the rationale is still useful (the user needs to know the actual tuple type); but the code is far less ugly. Also remember that the tuple is actually created!

Enjoy :-)

No comments:

Post a Comment