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.

583.Type<strong>and</strong>TypestateChecking Thereisnocoerciontomakeatypestatehigher,sothisstatementmustbe beforethecall.InthestatementcallParms.PutLine(L)intheh<strong>and</strong>ler, rejectedaserroneous.Thecompilerwillissueanerrormessagesayingthat attributeinit(L)wasrequiredbutnotpresent. Lisrequiredtobeinitialized,<strong>and</strong>itisnot,sothetypestateistoolow.<br />

ciency.Whenprogramsarewritteninunsafelanguages,eachuserhasto denedLcouldproduceunpredictableresults|possiblyevenaprogram trap.(ImagineLimplementedasapointertoastringbuer.)Thiswould Second,wegetearlydetectionofnonsenseprograms.Third,wegete-<br />

AllowingastatementlikecallParms.PutLine(L)toexecutewithanun-<br />

beputinaseparateaddressspacesothatoneuser'serroneousprogram befatal,especiallyifourprogramisamulti-usersystem.Andifwedidn't detecttheerroratcompile-time,we'dhavetocheckforitatrun-time. WhatbenetsdowegetfromtypestatecheckingFirst,wegetsecurity.<br />

maticallygenerateddiscardsofvalues.Forinstance,wesawthatwhenthe otherwisehave.Finally,wegetfreegarbagecollectionintheformofauto-<br />

EndStreamexceptionwasraised,theappropriatevariableswerediscarded beforeenteringtheexceptionh<strong>and</strong>ler. addressspace.Becausetheimplementationissecure,wegettheprotection ofaddressspacesattherun-timecostoflightweightprocesses.Andon can'thurtanotheruser.Butwecanrunmultiple<strong>Hermes</strong>processesinone machineslackingmemorymapping,wegetprotectionwhichwewouldnot<br />

youcankeeptheinterface\inyourhead",youmayconsiderwritingextra Ifyou'rewritingaprocedurewhichnoonebutyourselfisgoingtouse<strong>and</strong> systems,soitfavorstherstpointofviewoverthesecond. declarationsaburden.<strong>Hermes</strong>isdesignedprimarilyforlarge,long-lived someoneelse'smodules,theextradocumentationontheinterfaceisuseful. typestatesofcallparametersoninterfaces.Thiscanbeviewedaseithera burdenorabenetdependinguponyourpointofview.Ifyou'repickingup WhatpricedowepayYouhavetodeclarethepre-call<strong>and</strong>post-call

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

Saved successfully!

Ooh no, something went wrong!