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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

inport2,thethirdclausewillexecute;ifmessagesarriveatbothports, 10011.3.ControlFlowOperations<br />

thestatementwillblock. atinport1,thesecondclausewillexecute;ifamessagearrivesonlyat secondclausemaybeexecuted.Ifx0,thenif nomessageeverarrivesatinport1therstclausemusteventuallybe<br />

init.Thetypestateonentrytoanyclauseisthetypestateafterevaluatingallguards.Thetypestateonnormalterminationofthestatementis<br />

checkedtobeoftypefamilyinputport. sionsareinferredtobeoftypepredefined!boolean.Eventguardsare twoclauses. averagesalary,thenanon-deterministicchoiceismadebetweentherst behaveslikethechoicestatementsofotherlanguages.Iflowsalary= Allbooleanguards<strong>and</strong>alleventguardsmusthavetypestateattribute Herearethetype<strong>and</strong>typestatecheckingrules:Booleanguardexpres-<br />

Inthesecondexample,therearenoeventguards,<strong>and</strong>thestatement<br />

mally;ifnoneoftheclausescanexitnormally,thenneithercantheselect themeetofthetypestatesoncompletionofallclauseswhichcanexitnor-<br />

statement. ExpressionBlock<br />

able.Sinceexpressionsarenotsupposedtohavesideeects,allvariables clausecontainingstatementstocomputetheresultvariable. declaredoutsidetheexpressionblockareconstantwithintheblock. Anexpressionblock,orevaluateoperator,isawaytoembedstatements withinanexpression.Itcontainsadeclarationofaresultvariable,<strong>and</strong>a Theexpressionblockintroducesanewscopecontainingtheresultvari-<br />

secondary::=evaluatedeclarationfrom[statement;]...end<br />

normalexitfromtheblock.Itisa\deadcode"erroriftheclausedoesnot haveanormalexit.Theblockmustinitializetheresultvariable. Thetypestateafterexecutinganexpressionblockisthetypestateon forLispObjectinLispObjectswhere (evaluateStartsWithZ:booleanfrom blockbegin endblock; on(CaseError) revealLispObject.Pair; revealLispObject.Pair.Car.PrintName; StartsWithZ:=LispObject.Pair.Car.PrintName=Z; StartsWithZ:='false';

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

Saved successfully!

Ooh no, something went wrong!