[sv-bc] Namespace issue w. struct/union member names?


Subject: [sv-bc] Namespace issue w. struct/union member names?
From: Rishiyur S. Nikhil (nikhil@bluespec.com)
Date: Wed Oct 29 2003 - 11:24:54 PST


I have a question re. "18.9 Name spaces".

Do the member names in each struct/union also belong to a separate
namespace?

- Can we have a struct member called 'x' in the same scope as
   something else named 'x' (say, a variable)?

- Can 'x' be a member name in two separate structs or unions?

I am assuming the answer to both questions is "yes", following C/C++,
but I can't seem to find the answers in the LRM.

If the answer is 'yes', then should Section 18.9 list each struct or
union definition as also introducing a new name space?

I think this is a name space issue and not a scope issue. For
example, in the expressions:

     x.x (i.e., variable.member)

     { x : x } (i.e., a struct expression)

the two x's in each expr (which are in the same scope) are resolved
differently. In the first expr the first x is a variable and the
second is a struct member name, and in the second expr the opposite is
true.

And: is there a similar question with class property and method names?

Nikhil



This archive was generated by hypermail 2b28 : Wed Oct 29 2003 - 11:27:22 PST