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.

constructs:thenewinput-port,connect<strong>and</strong>createstatements,<strong>and</strong>the InterfaceMismatchexception.Congratulations!Younowknowsixofthe 1.5Declarations<strong>and</strong>Denitions ten<strong>Hermes</strong>systemprogrammingstatements! 181.4.PuttingProcessesTogether<br />

morphic <strong>and</strong>howmuchshouldbeinferredbythecompilerShouldtypesbepoly-<br />

muchshouldtheprogrammerhavetowriteoutasexplicitdeclarations, averyimportantlooseendmentionedearlier|declarations<strong>and</strong>denitions. checking.Shouldtypecheckingbedoneatcompile-timeorrun-timeHow Let'stakeabreakfromlearningnewkindsof<strong>Hermes</strong>statements,<strong>and</strong>tieup <strong>Hermes</strong>takesthefollowingpositions: Thereismuchdebate<strong>and</strong>dierenceofopinionabouttheroleoftype Allprogramswillproducesemanticallywell-denedlocalizedeects| Programmingerrorswillbedetectedatcompiletimewhereverpossible.<br />

Programmersmustdeclarethetypesofallvariablesexceptexpression Infact,aprocesscanaccessonlythedatabelongingtoit. eitheranormalresultoranexception.Thismeansprogrammingbugs<br />

Therearenopolymorphictypes.They'renotneededasmuchwhen can'tcrashthesystem,orwriter<strong>and</strong>omgarbageintoanotherprocess.<br />

itlyintroducingpolymorphism.(<strong>Hermes</strong>hasapolymorphtype,which samegoal|namely,reusablesourcecodepackages|withoutexplic-<br />

insteadwritesatemplate<strong>and</strong>thencreatesspecicsortprogramsby substitutingspecictypesintothetemplate.Thisaccomplishesthe writingapolymorphicsortprogramwhichcansortanytype,one youhavetheabilitytocreateprogramobjectsonthey.Insteadof temporaries.Thecompilerinfersthetypesofexpressiontemporaries.<br />

statementsweshowedyouearlier. 1.5.1Declarations Wewillnowshowyouthecompletetextoftheprogramswhoseexecutable HelloWorld:using(St<strong>and</strong>ard)process(Init:St<strong>and</strong>ardIn) allowsavariabletoholdavalueofanytype,therebydeferringtype<br />

declare checkinguntilrun-time.)<br />

begin Parms:St<strong>and</strong>ardInterface;--callmessagereceivedfromparent receiveParmsfromInit;

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

Saved successfully!

Ooh no, something went wrong!