[sv-bc] Ballot issue 11/Mantis 2665 - are compilation unit imports re-exported

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Mon Apr 27 2009 - 08:55:11 PDT
The ballot issue uses the example:

    package P;
       integer r;
    endpackage

    import P::*; // P is imported in compilation unit scope

    module top;
       integer s = $unit::r; // ‘r’ refers to the declaration in package P
                             // imported in compilation unit scope
    endmodule


The question is (essentially) whether imports into the compilation
unit are implicitly re-exported.

This question is directly related to Issue 10/Mantis 2664.  See
me comments on that item first.

I don't think that this is the correct view at all.  The compilation
unit is simply a lexical scope so all identifiers visible in that
scope are lexically resolved in a normal manner.  The $unit::r
is simply a naming mechanism to get at the scope (since it is
otherwise anonymous).  The "::" syntax here is a bit misleading
as it reinforces the view of $unit as a package (which it is not).
It might have been an idea to use "." rather than "::" but that
would have suggested an even worse view -- that such references
are hierarchical (and might allow arbitrary forward references).
That is clearly not the intent; 3.12.1 has:
    The use of an explicit $unit:: prefix only provides for
    name disambiguation and does not add the ability to refer
    to later compilation unit items.


Gord.

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Apr 27 09:41:20 2009

This archive was generated by hypermail 2.1.8 : Mon Apr 27 2009 - 09:42:44 PDT