28.01.2015 Views

Hermes: A Tutorial and Reference Manual - Researcher - IBM

Hermes: A Tutorial and Reference Manual - Researcher - IBM

Hermes: A Tutorial and Reference Manual - Researcher - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ments.Therstargumenttocasemustbeavariantvariable,<strong>and</strong>thesecondmustbeacomponentofthesamevariantvariable.Attributechecked<br />

musthaveasingleargumentoftypepredefined!program.Attribute definitionsmodule. checkeddefinitionsmusthaveasingleargumentoftypepredefined! Allotherattributenamesareconstraintattributes.Whenyoumention 10.TypestateChecking85<br />

howmanyattributeargumentstheremustbe<strong>and</strong>whatthetypeofeach aconstraintattribute,therewillbeaconstraintdenitionwhichspecies mustbe. Forexample,ifthereisaconstraintdenition greaterthan:constraint(a:integer,b:integer)IS<br />

thisuseasanabbreviation,youmaynotdeneanattributenamedfull. X.AofX.Forothertypes,fullmeansthesameasinit.Fromnowon, we'llassumefullhasbeenexp<strong>and</strong>edoutwhereveritappears.Becauseof it'sthesameasifyouwroteinit(X)<strong>and</strong>full(X.A)foreachcomponent abbreviation.Ifyouwritefull(X),<strong>and</strong>Xisarecordorcallmessage,then argumentsoftypeinteger. thentheattributegreaterthanmustalwaysappearwithexactlytwo Thenamefullissyntacticallyanattributename,butitistreatedasan finit(a),init(b)ga>b;<br />

Herearethemeaningsofthetypestateattributes: checked(P)meansthatprogramPhasbeenchecked<strong>and</strong>isfreeof case(V,V.X)meansthatvariantVisrevealed,<strong>and</strong>componentV.X init(X)meansthevariableXisinitialized;otherwiseitisuninitialized.<br />

exists;theabsenceofcase(V,...)meansthatvariantVishidden. syntaxerrors,includingresolutionerrors,typeerrors,<strong>and</strong>typestate checked<strong>and</strong>assignedauniquename.(Seethediscussionofthecheckdefinitions errors. checkeddefinition(D)meansthatdenitionsmoduleDhasbeen<br />

10.2FormalTypestates attributename(arguments)meansthatthenamedconstraintpredicateisknowntobetrueofitsarguments.<br />

statement.)<br />

Sometimesatypestatemustbewrittenwithoutthebasevariables.For example,hereisthedenitionofarecord,<strong>and</strong>atableoftheserecords: R:record(A:integer,B:Charstring);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!