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.

768.1.VariableNames 8.1.1BaseVariables Basevariablesaredenedwithinnamespacescalleddeclarationslists.The Examples:Foo,Foo.Bar,Foo.Bar.Baz. base{variable<br />

pearonlywithinexecutablecode|eitherprocessmodulesorconstraint regionofvisibilityofadeclarationslistiscalleditsscope.Scopesap-<br />

::=identier<br />

theprogrammerc<strong>and</strong>eclarebasevariables.Theselector,theinspect,the tializationportdeclaration<strong>and</strong>thebasevariablesdeclaredfollowingthe forstatement,<strong>and</strong>theexpressionblockalsointroducescopescontaining constraintdenition. denitions.Theoutermostscopeinthiscaseisthedeclarationlistofthe declarekeyword.Theblockstatementdenesaninnerscope,inwhich asinglebasevariabledeclaration.Scopesalsoappearwithinconstraint denitions.Scopescanbenested.Inanexecutablemodule,theprocess bodyistheoutermostscope.Thedeclarationslistcomprisesthetheini-<br />

declarationproducinga\hole"intheoutervariable'sscope.)Itispermissibleforthesameidentiertobedeclaredtwicewithinaprogramifthe<br />

scopesdonotoverlap.Example: block Itisillegalforthesameidentiertobedenedwithintwooverlapping scopes.(Inotherlanguages,thisinnerdeclarationwould\hide"theouter<br />

begin declare forXinT[]--illegalredeclarationofX X:integer; T:tableofintegers; inspect<br />

withinitsscope.Becausebasevariablescannothaveoverlappingscopes, forTinZwhere(T>0)--legalredeclarationofT Theresolutionruleforbasevariablesistrivial:Abasevariableisvisible endblock; inspect endfor; callPutLine(IntToString(T)); endfor; callPutLine(IntToString(X));<br />

variable. therecanbeamaximumofonevisibledeningoccurrenceofanybase

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

Saved successfully!

Ooh no, something went wrong!