RE: [sv-bc] Ballot issue 10 / Mantis 2664 - compilation unit declarations are imported?

From: Francoise Martinolle <fm_at_.....>
Date: Mon May 11 2009 - 13:34:26 PDT
 

I agree with this interpretation.
Francoise
    '
-----Original Message-----
From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of
Gordon Vreugdenhil
Sent: Monday, April 27, 2009 11:47 AM
To: SV_BC List
Subject: [sv-bc] Ballot issue 10 / Mantis 2664 - compilation unit
declarations are imported?

This issue uses the following example:

    integer r;

    module top;
      integer s = r; // 'r' is imported in the module
      integer r; // error, declaration
    endmodule

The question is essentially whether compilation unit items are
implicitly imported into a referencing scope.

I do not think that compilation unit items are implicitly imported; they
are visible due to lexical scoping.

In 3.12.1 we have:

     When an identifier is referenced within a scope:
         First, the nested scope is searched (see 23.9) (including
nested
         module declarations), including any identifiers made available
         through package import declarations.

         Next, the portion of the compilation-unit scope defined prior
to
         the reference is searched (including any identifiers made
         available through package import declarations).


And in 26.3:
     The search algorithm shall be repeated for each outer lexical
     scope until an identifier is found that matches the reference or
     there are no more outer lexical scopes, the compilation unit scope
     being the final scope searched.

Both of these quite clearly consider the compilation unit as a lexical
scope to be searched, not as a set of potentially visible identifiers.
Note in particular that the second paragraph from
3.12.1 quoted above is clear that declarations imported into the
compilation unit are visible in the same manner as a normal lexical
search.  This would be at odds with an "import" view of compilation
items unless the LRM stated that such items were implicitly "exported"
from $unit.


So although 3.12.1 comments that "Thus, the compilation-unit scope is
similar to an implicitly defined anonymous package.", I think that is
related to the kinds of items and is related to being able to share
across modules without hierarchical references.  I do not think that
statement is meant to imply "import like" behavior for referenced
identifiers.

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.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon May 11 13:35:53 2009

This archive was generated by hypermail 2.1.8 : Mon May 11 2009 - 13:36:59 PDT