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.

462.7.TheWindowManager callCurrentWindow.InputToWindow(DispatchCM.Line);<br />

ofanyothertypecontainingthesetypes(suchasarecordcontainingan <strong>and</strong>callmessagetypefamiliesarenotcopyable.Variablesofthesetypes,or selectorexpressiontocopyanelementfromthetableintoavariable.We shouldpointoutonesituationinwhichthisdoesnotwork.Theinputport Thisprogramillustratesonewaytolookupsomethinginatable|usea endblock; on(NotFound) returnDispatchCMexceptionNotFound; returnDispatchCM;<br />

inputportoratablecontainingacallmessage)cannotbecopied.Todoa tablelookupwhenthetableelementscannotbecopied,usetheinspect statement.Hereisthesameprogramfragmentrewrittenwiththeinspect<br />

blockbegin receiveDispatchCMfromDispatch; inspectWinCreatedWindows[DispatchCM.WindowName] begin<br />

anobjectofanydatatype,becausetheproblematicoperationsareillegal elementoftableCreatedWindows.<strong>Hermes</strong>doesnotallowmakingcopies returnwouldbecomecomplex.Howeverconstantcopiesmaybemadeof ofinputports<strong>and</strong>callmessages,becausethesemanticsofreceive<strong>and</strong> TheinspectstatementassignsWfromaconstantcopyoftheselected on(NotFound) endblock; endinspect; callW.InputToWindow(DispatchCM.Line);<br />

non-copyablecases. Thatway,youwillnothavetousetwodierentstylesforthecopyable<strong>and</strong> whenappliedtoconstants. fortablelookupallthetime,evenwhenthetableelementsarecopyable. declareCurrentWindow.Butintheversionusinginspect,youdon'twrite oftableCreatedWindows.Youmaywishtousetheinspectstatement newscopeinwhichWisdeclaredtohavetypeWindow|theelementtype aseparatedeclarationforthevariableW.Theinspectstatementdenesa Theinspectstatementselectsexactlyoneelement(orelseraisesan Intheprogramfragmentwrittenwithoutinspect,itisnecessaryto<br />

eachelementofatablewhichsatisestheselectorpredicate.(Thismaybe forstatementiterativelyexecutesthestatementswithinitsbodyoncefor exception).Toselectallelements,iteratively,useaforstatement.The example,hereisapieceofcodewhichprintsthenamesofalltheactive zerotimesifthetableisemptyorifnoelementsatisestheselector.)For windows: forWindowinCreatedWindowswhere('true')

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

Saved successfully!

Ooh no, something went wrong!