Re: [sv-bc] Importing a enum from a package don't import enum variable??

From: Steven Sharp <sharp_at_.....>
Date: Fri Mar 09 2007 - 13:39:06 PST
>can you Please let me know that if an enum is defined in a package then
>while importing the enum from that package in a module,the enum variable
>should also be imported or not. According to LRM P1800.2005  section
>19.2.2 it seems as it bug of LRM itself as it is showing that importing a
>enum does not import the enum variable while for other like structure,
>importing a structure import the structure member also so it seems as it
>is  bug of LRM .

Here is my understanding of the reasoning:

The struct member names are not actually imported into the module.
They can be referenced only through a struct, as if that struct
were a scope.  Since they are not actually being imported into the
module namespace, they cannot collide with symbols already there.

If the enum literal names were automatically imported when the
enum was imported, they could collide with symbols already in the
module.  It would be impossible to import the enum without getting
this collision.  Since there are situations where you might need
the enum, but not the literals, this would cause problems.

If you are carefully importing specific symbols, it is presumably
because you want precise control of what symbols you are getting.
Automatically bringing in symbols that you did not ask for would
defeat that control.  Where you are not concerned about collisions
and want a convenient way to get the enum and its literals, you
can use the wildcard import.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri Mar 9 13:39:54 2007

This archive was generated by hypermail 2.1.8 : Fri Mar 09 2007 - 13:40:07 PST