Re: [sv-bc] Referencing $unit identifiers from within a package

From: Greg Jaxon <Greg.Jaxon_at_.....>
Date: Wed Apr 12 2006 - 12:35:13 PDT
Arturo Salz wrote:

> foo is an implicit hierarchical reference into $unit.

I wouldn't call it "hierarchical" since no instance names
are needed to reach it.

> Items defined in the compilation-unit scope cannot be accessed by name 
> from outside the compilation unit.

The deep magic of scoping, data abstraction, and encapsulation
is that types and objects can exist without having a name accessible at
the point where their effect is felt.  Indeed, this could be the
package author's way of declaring "private" types - but it depends
on the build flow to give each package a separate $unit.

> Since in the example, foo is indirectly being exported via the package,

The name foo is not exported from p.

The type of A is well-defined, and that type identity /is/ part
of the definition of A, a name which is exported from p.

If Dave's example had used a strong type for foo, there would
be quite some question about whether type(A) matches anything
else claiming to be type "$unit::foo".  My reading is that this
match would only occur if the claimant and package p share the
same $unit per section 19.3.

> I believe this should be illegal.

It is merely ill-advised, not illegal.
Received on Wed Apr 12 12:37:55 2006

This archive was generated by hypermail 2.1.8 : Wed Apr 12 2006 - 12:38:01 PDT