wiki:RefactoringSteps/GenerateFunctionSpecification

Generate function specification

The “generate function specification” transformation calculates the specification of the selected function and insert the -spec directive in front of the function.

Inserting specification for function f:

j(X, ok) ->
   X + 2.

Result:

-spec(j(float()|int(),atom())
   ->float()|int())

j(X, ok) ->
   X + 2.

Side conditions

  • There is no side condition to use this transformation.

Transformation steps and compensations

  1. Calculates the specification of the function.
  1. Inserts the specification.
Last modified 13 years ago Last modified on Feb 19, 2012, 11:48:34 PM