Changes between Initial Version and Version 1 of RefactoringSteps/RenameRecordField


Ignore:
Timestamp:
Feb 15, 2012, 2:37:22 PM (13 years ago)
Author:
manualwiki
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RefactoringSteps/RenameRecordField

    v1 v1  
     1= Rename record field = 
     2 
     3The rename record field transformation supports renaming the specified field of a record. The name of the field is replaced in the definition form and in every referrer expression and token to the given new name. To the field belongs a semantic field object linked to the record, it stores the field name. The data of this object is updated too. 
     4 
     5Renaming field {{{name}}} to {{{id}}}: 
     6 
     7{{{ 
     8-record(member, {name, age}). 
     9 
     10rename(Arg, New) -> 
     11   #member{name=Name} = Arg, 
     12   io:format("%s == %s", 
     13      [Name, Arg#member.name]), 
     14   Arg#member{name=New}. 
     15}}} 
     16 
     17Result: 
     18 
     19{{{ 
     20-record(member, {id, age}). 
     21 
     22rename(Arg, New) -> 
     23   #member{id=Name} = Arg, 
     24   io:format("%s == %s", 
     25      [Name, Arg#member.id]), 
     26   Arg#member{id=New}. 
     27}}} 
     28 
     29== Side conditions == 
     30 
     31 * The record must have no field with the same name as the given new field name. If it has, the transformation starts an interaction to ask for a new record field name. 
     32 
     33 * If the user does not specify a record field, then the transformation starts an interaction to ask the user to specify one. 
     34 
     35== Transformation steps and compensations == 
     36 
     37 1. The field name is changed to the new name in the definition of the record and in every record expression that refers the field.