Re: [sv-bc] namespaces


Subject: Re: [sv-bc] namespaces
From: Randy Misustin (ram@model.com)
Date: Tue Jun 17 2003 - 21:21:59 PDT


Hello Francoise,

Francoise Martinolle wrote:

>Randy,
>
>can you have an import statement inside a scope like a named block, named fork, task etc...
>If so what is the effect if it appears after some declarations? Does it hides the previous declarations
>of do you raise a compilation error?
>
>
Yes, it can appear inside a scope. If it's a nested scope and the
homograph is in a surrounding scope, it will hide it. Otherwise when the
homograph is earlier in the same scope, it is either an error (explicit
import) or the imported candidate import doesn't become visible
(wildcard import).

>I see that there is a difference in import of a declaration depending if it is imported
>as part of a wildcard import or as part of a single import declaration.
>Why this difference?
>
>
If one is importing an explicit symbol, the compiler should deduce that
there is an intention to use it and a name collision implies the
likelyhood of unexpected behavior. For wildcard imports, this deduction
shouldn't necessarily be made. There may be an intent to use some or
most of a namespace, but not all of it. Worse, someone adding a new
function (for example) to a namespace could possibly break code
importing that namespace at next compile without the client of the
namespace having changed anything.

If there's a strong desire to unite to a single homograph behavior, I
definitely vote for making it work the way wildcard imports are
currently defined.

>Effectively if you have a namespace declaring some data types and functions operating on these data types, and you want to use the imported declarations for all the modules in your design,
>you have to insert the import declaration before every module used in your design.
>
>
Correct.

-randy.

>Francoise
> '
>
>



This archive was generated by hypermail 2b28 : Tue Jun 17 2003 - 21:24:30 PDT