Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!ucselx!petunia!kestrel.edu!gyro From: gyro@kestrel.edu (Scott Layson Burson) Newsgroups: comp.std.c++ Subject: Re: "module" facility for top-level namespace control Keywords: namespace, module Message-ID: <1991Apr24.100733.19988@kestrel.edu> Date: 24 Apr 91 10:07:33 GMT References: <5143@lupine.NCD.COM> <1991Apr21.014746.3526@kestrel.edu> <5176@lupine.NCD.COM> Distribution: comp.std.c++ Organization: Kestrel Institute, Palo Alto, CA Lines: 54 In article <5176@lupine.NCD.COM> rfg@NCD.COM (Ron Guilmette) writes: >In article <1991Apr21.014746.3526@kestrel.edu> gyro@kestrel.edu (Scott Layson Burson) writes: >>... Also, if there were also some sort of >>`use' declaration, I think I would really want it to work only on >>modules; otherwise its definition has to be that it makes the names of >>only static members visible, because it wouldn't make sense to make >>the names of normal (nonstatic) members visible... > >I disagree. > >I don't see anything wrong with a generalized "opening of the scope" >which applies to both static and non-static members. In some cases, >it might actually be useful. For example: > > struct S { > int data_member; > void func_member (void); > }; > > int S::*data_mbr_ptr; > int S::*func_mbr_ptr; > > int i; > > void example () > { > use S; // scope opener > > i = S::data_member; // error - no object specified > i = data_member; // error - no object specified > > S::func_member(); // error - no object specified > func_member (); // error - no object specified > > data_mbr_ptr = &S::data_member; // OK > data_mbr_ptr = &data_member; // also OK > > func_mbr_ptr = &S::func_member; // OK > func_mbr_ptr = func_member; // also OK > } In the language as it stands (the ARM, anyway), the only way to create a pointer to member is with the `&A::b' syntax. I vigorously object to any proposal that would make it possible to create them without the qualifier, because I think that they are very much unlike pointers (the term "pointer to member" notwithstanding). I also think this example is pretty contrived. I stand by my original opinion: the scope opener makes sense only on static members. -- Scott Gyro@Reasoning.COM