Next Previous Up Top

5 Examples

5.6 Attaching Properties to Parameters

5.6 Attaching Properties to Parameters

In a similar trend, but going a little bit further than the previous example, one might need to attach properties to arguments of member functions. For instance, in a distributed implementation, the user of a remote object could specify that some parameters are transmitted with a deep copy semantics, while others only require a reference semantics.

In that case again, a non reified routine (set_param_semantics) can provide for such pattern:

void main()
	Sim_Supermarket* sim_obj;
	sim_obj = ec_new ((), Sim_Supermarket, ());
	// Initialization
	sim_obj->set_param_semantics (mid2(Sim_Supermarket,enter),COPY,REF,COPY);
	// Use
	sim_obj->enter(blond,woman,thin); // blond and thin have copy semantics
	// woman a reference semantics

Copyright 1997 EUROPA WG

Last updated: 26 Nov 1997