RSL Conventions
Note in this example that the name "in" cannot be used as a variable name since in is a keyword of RSL.op F(id:Identifier, ind:Index, it:Iteration);
op F(i1:Identifier, i2:Identifier)
orop F(id1:Identifier, id2:Identifier)
obj Date is time:Time and day:Day;
whereas the following semantically equivalent definition is bad form:obj BlahBlahList is BlahBlah*; obj BlahBlah is Blah and Blah; obj Blah is integer;
obj BlahBlahList is (integer and integer)*; -- Bad form
obj Things is Thing*; (* A collection of Things where order is unimportant to the user. *) obj ThingList is Thing*; (* A collection of Things where order is important to * the user. *)
obj Datum is X and Y; op GetX(Datum)->X; op GetY(Datum)->Y;
obj DataList is Datum*; obj Datum is k:Key and v:Value; op Find(DataList, Key)->Datum;
andobj X < Parent is A and B and C;
in the same specification.object Y instance of Parent is components: D and E and F; end Y;
(* * Put descriptive comment for the module in a comment of this form. *) module M; object Name is ... --^ Indent object and operation keywords 2 spaces description: (* ----^ indent attribute names 4 spaces This is the description ... . It should be longer for more complicated and conceptually major entities, shorter for smaller, more conceptually minor entities. --------^ Indent description text, and other multi-line attribute values 8 spaces, i.e., 1 tab, with tab width set = 8 *); ----^ indent end of description comment 4 spaces end Name; --^ Indent object and operation ender 2 spaces. end M;
Figure 1: Indentation and commenting conventions.