25.07.2014 Views

VDM-10 Language Manual

VDM-10 Language Manual

VDM-10 Language Manual

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.

Chapter 17. Top-level Specification (<strong>VDM</strong>-SL)<br />

✞<br />

✡✝<br />

name renamed new_name<br />

✆<br />

where name is the name of the imported construct, and new name is the new name for the<br />

construct. This way, more meaningful names can be given to constructs. Note that in the<br />

importing module it is not possible to refer to DefModule‘name (where DefModule is<br />

the name of the defining module) any longer but only to newname.<br />

It is possible to include type information in the imports section, such that this information<br />

will only be used by the static semantics check of the complete module. If no type information<br />

is given, the static semantics can also find this information in the exporting module (see<br />

section 19).<br />

When a type which has been exported with the struct keyword (with its structure) is<br />

imported the importing module may only make use of this structure if it repeats the type<br />

definition from the exporting module in its type import. In case such a type is a composite<br />

type and it is also renamed this has the consequence that the tag is renamed as well.<br />

Examples: We can model an ATM card as consisting of a card number and an expiry date. This<br />

requires the digit type defined in the module BankAccount. It also uses the function<br />

digval from the same module.<br />

✞<br />

module ATMCard<br />

imports<br />

from BankAccount types digit<br />

functions digval renamed atmc_digval<br />

exports all<br />

definitions<br />

types<br />

digit = BankAccount‘digit;<br />

atmc:: cardnumber : seq1 of digit<br />

expiry : digit * digit * digit * digit<br />

inv mk_atmc(cardnumber, mk_(m1,m2,-,-)) ==<br />

atmc_digval(m1) * <strong>10</strong> + atmc_digval(m2) = 8<br />

functions<br />

159

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

Saved successfully!

Ooh no, something went wrong!