transform

transform is a top level declaration expressing how a type can be transformed to another.

A transform definition accepts an object of an input type, and returns an object of the output type by executing expressions/statements in the transformer. Multiple inputs can also be specified.

transform definitions are generated into code to be used as part of a native-code code library or to be hosted in a service. A transform is uniquely identified by its input types and output type. The types specified to a transform will be resolved relative to the current namespace.

Types specified to tranform need to be concrete types, trait cannot be specified to a transform. Future versions will allow transforms based on trait types.

Also see transform on how to use the transform() function.

Example Transform

// Single input value transform
transform( i : InputType ) : OutputType {
   ...
   return new OutputType( ... )
}

// Multi-input value transform
transform( x : InputTypeX, y : InputTypeY ) : OutputType {
   ...
   return new OutputType( ... )
}

Syntax of a transform declaration

transform( <list of named input parameters> ) : <result type> {
    <statements>
    return <new object of result type>
}