wiki:RefactoringSteps/GenerateFunctionSpecification

Version 1 (modified by manualwiki, 13 years ago) (diff)

--

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.