XML

kent logo

CO538 Anonymous Questions and Answers Keyword Index

This page provides a keyword index to questions and answers. Clicking on a keyword will take you to a page containing all questions and answers for that keyword, grouped by year.

To submit a question, use the anonymous questions page. You may find the keyword index and/or top-level index useful for locating past questions and answers.

Keyword reference for free-variable

2000

Question 85 (2000):

I have expanded my dining philosophers animation network like this:

  [5]CHAN OF PHILOSOPHER a:
  [5]CHAN OF FORK b:
  PAR
    secure.college (a, b)
    display (a, b, screen)

but the compiler is telling me:

    Aliasing error, 'screen' is a free variable.

Any thoughts?

Answer 85:

Yes. It must be the case that your display process does not name its third parameter screen, but nevertheless outputs to a channel called screen. Something like:

  PROC display ([5]CHAN OF PHILOSOPHER from.phil,
                [5]CHAN OF FORK b,
                CHAN OF BYTE out)
    ...  and in here outputs to the 'screen' channel instead of 'out'
  :

Now, this PROC compiles because screen is a globally visibly channel carrying the right protocol (BYTE). It must also be the case that that channel exists because you have declared display inside the body of your main q7 process, where screen is declared as a parameter. [If it had been declared on its own before your main q7 process, it would not have compiled - complaining instead about the unknown channel called screen, which would have been nice.]

Assuming the above, when the compiler came to the attempted instance:

    display (a, b, screen)

it would see an attempt to associate the real channel screen with the formal parameter out. But the compiler knows that your display outputs to this screen directly - so that the process would have two names for the same channel: out and screen. occam does not allow such aliases to happen - hence the error message.

Keywords: q7 , free-variable

Valid CSS!

Valid XHTML 1.0!

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
Last modified Mon May 20 13:50:27 2013
This document is maintained by Fred Barnes, to whom any comments and corrections should be addressed.