Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!microsoft!jimad From: jimad@microsoft.UUCP (Jim ADCOCK) Newsgroups: comp.lang.c++ Subject: Re: namespace (rethought & reiterated) Message-ID: <71027@microsoft.UUCP> Date: 4 Mar 91 18:15:04 GMT References: <2620020@otter.hpl.hp.com> <4196@lupine.NCD.COM> Reply-To: jimad@microsoft.UUCP (Jim ADCOCK) Organization: Microsoft Corp., Redmond WA Lines: 56 In article <4196@lupine.NCD.COM> rfg@NCD.COM (Ron Guilmette) writes: |Is there a solution? Sure. We could introduce a `with' statement (as in |Pascal) which could specify that within a given region, a particular class |type should be used for implicit qualification (when necessary), e.g.: | | -------------------------------------------------------------------- |#include | |double d; | |void foobar () |{ | with (incl) | { | double_p_type dp = &d; | | myfunc (dp, (char) somedata); | } |} |-------------------------------------------------------------------- How about something like: #include double d; void foobar() { struct incl_ : public incl { static void with() { double_p_type dp = &d; myfunc (dp, (char) somedata); } }; incl_::with(); } suitably macro-hacked, this becomes: void foobar() { with(incl) { double_p_type dp = &d; myfunc (dp, (char) somedata); } end_with(incl) } 1/2 :-}