Anthony Borla wrote:
According to Section 5.5 of the Oz Docuemntation it is possible to have
identically-named variables at different scopes. Access to the outer-scoped
variable is possible [in certain contexts] via the '!' operator which
'suppresses' the inner-scoped variable.

The following code uses this approach, but it doesn't seem possible to
access the outer variable to assign it a value; instead, the program fails
[diagnostic given in code comment]:

functor

import
  System Application

define
  proc {ComputeStatistics}
    N = 5.0

    local
      AVGDEV = {NewCell 5.0}
    in
      % Access to 'local' AVGDEV ok
      AVGDEV := @AVGDEV / N

      %
      % How to access to 'outer' AVGDEV ? This approach
      % fails with:
      %
      % %** Tell: 1.0 = <Cell>
      %
      % message
      %

      !AVGDEV = @AVGDEV
    end
  end

Please show me where the 'outer' AVGDEV is declared. I looks to me that you are confusing lexical scope with cell assignment!

Cheers,
raph

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to