PROJECT - Module

PROJECT( module, interface [, OPT | attributelist ] )

moduleThe MODULE structure containing the attribute definitions whose values to pass as the interface.
interfaceThe INTERFACE structure to pass.
OPTOptional. Suppresses the error message that is generated when an attribute defined in the interface is not also defined in the module.
attributelistOptional. A comma-delimited list of the specific attributes in the module to supply to the interface. This allows a specified list of attributes to be implemented, which is useful if you want closer control, or if the types of the parameters don't match.
Return:PROJECT returns a MODULE compatible with the interface.

The PROJECT function passes a module's attributes in the form of the interface to a function defined to accept parameters structured like the specified interface. This allows you to create a module for one interface with the values being provided by another interface. The attributes in the module must be compatible with the attributes in the interface (same type and same parameters, if any take parameters).

Example:

PROJECT(x,y)
/*is broadly equivalent to
MODULE(y)
  SomeAttributeInY := x.someAttributeInY
  //... repeated for all attributes in Y ...
END;
*/

myService(myInterface myArgs) := FUNCTION
  childArgs := MODULE(PROJECT(myArgs,Iface,isDead,did,ssn,address))
    BOOLEAN isFCRA := myArgs.isFCRA OR myArgs.fakeFCRA
  END;
  RETURN childService(childArgs);
  END;

// you could directly pass PROJECT as a module parameter
// to an attribute:
myService(myInterface myArgs) := childService(PROJECT(myArgs, childInterface));

See Also: MODULE Structure, INTERFACE Structure, FUNCTION Structure, STORED