Re: [sv-bc] Hierarchical resolution in nested modules

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Tue Dec 04 2007 - 07:05:00 PST
Steven Sharp wrote:
>> From: "Bresticker, Shalom" <shalom.bresticker@intel.com>
>>
>>
>> It is not even clear from the LRM that it is legal to instantiate a
>> nested module from a scope which is lexically nested within the scope
>> where the nested module is declared. I don't object to it, but the LRM
>> does not make it clear that it is allowed.

It actually doesn't address that at all.  The "provided the module" clause
is not directive, it merely adds a condition.

It would render nested modules much less useful if one could not use
them in generate loops, conditions, etc.  I certainly don't read into
the text that a nested module "shall be instantiated only in the scope
of definition".

> An intermediate interpretation of that text would be that it is legal,
> but names cannot be bound lexically to the outer module in that case.

It depends on whether "names" mean "all identifiers including simple
names" or whether it means "some names such as functions which bind
hierarchically".

> Whether it is illegal, legal but cannot bind lexically, or legal but
> binds from the point of instantiation, the text does not appear to
> support Gord's interpretation.

If you follow the rest of the LRM precedent in terms of resolution
in generate blocks and the like, I think my interpretation is not
unreasonable.  Some names use hierarchical binding.  Thus you
get the same as "lexical" binding "provided that the module is declared
and instantiated in the same scope".

If you go with the "you never get lexical binding" view, then we have
very serious issues to discuss in terms of imports and the visibility
of types, etc, etc.  I just don't think that is a feasible interpretation.

If we require instantiation in only the scope of declaration then
nested modules are seriously compromised.

> Does someone know the original intent?

Certainly we appear to be interpreting things quite differently.
That generally means there is at least a few more interpretations
which are differ from either of us...

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 Tue Dec 4 07:05:19 2007

This archive was generated by hypermail 2.1.8 : Tue Dec 04 2007 - 07:05:43 PST