473,509 Members | 2,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Global namespace problem in .NET

I already asked this question in the VB.NET group but as C# seems to have the
same problem, I'll try here, too.

I have 2 external OEM assemblies A1 and A2 that both define class X (same
name, not same class) in the global namespace. I need to use both X'es in my
project. How do I fully qualify the X'es to avoid the name clash between X
from A1 and X from A2.

The using statement provides a way of aliasing clashing names from named
namespaces but it does NOT give the possibility to resolve name clashes in
the global namespace. Or is it possible?

Any bright minds out there who have a solution?

Otherwise, this seems to be a serious problem with .NET languages. I hope
somebody from Microsoft sees this and gets this problem fixed.

Nov 17 '05 #1
4 5368
How large is the surface area of each of your OEM assemblies? Could you
create namespaced proxies for them?

Please shoot the supplier of any assemblies using global types. It might
seem excessive now, but unless we stop these people reproducing, they'll
keep at it.

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton

"anders" <an****@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com...
I already asked this question in the VB.NET group but as C# seems to have the same problem, I'll try here, too.

I have 2 external OEM assemblies A1 and A2 that both define class X (same
name, not same class) in the global namespace. I need to use both X'es in my project. How do I fully qualify the X'es to avoid the name clash between X
from A1 and X from A2.

The using statement provides a way of aliasing clashing names from named
namespaces but it does NOT give the possibility to resolve name clashes in
the global namespace. Or is it possible?

Any bright minds out there who have a solution?

Otherwise, this seems to be a serious problem with .NET languages. I hope
somebody from Microsoft sees this and gets this problem fixed.

Nov 17 '05 #2
Shooting people is hardly the solution to this problem. Inevitably there will
be clashes in the global name space even when you use namespaces. The
outermost namespace of every assembly is in the global scope and a name clash
is always possible so there should be a mechanism of resolving them!

How would you create a namespaced proxy?

"Tim Haughton" wrote:
How large is the surface area of each of your OEM assemblies? Could you
create namespaced proxies for them?

Please shoot the supplier of any assemblies using global types. It might
seem excessive now, but unless we stop these people reproducing, they'll
keep at it.

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton

"anders" <an****@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com...
I already asked this question in the VB.NET group but as C# seems to have

the
same problem, I'll try here, too.

I have 2 external OEM assemblies A1 and A2 that both define class X (same
name, not same class) in the global namespace. I need to use both X'es in

my
project. How do I fully qualify the X'es to avoid the name clash between X
from A1 and X from A2.

The using statement provides a way of aliasing clashing names from named
namespaces but it does NOT give the possibility to resolve name clashes in
the global namespace. Or is it possible?

Any bright minds out there who have a solution?

Otherwise, this seems to be a serious problem with .NET languages. I hope
somebody from Microsoft sees this and gets this problem fixed.


Nov 17 '05 #3
"anders" <an****@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
Shooting people is hardly the solution to this problem.
No, it isn't. But it will help prevent the problem from recurring, and will
also make you feel a lot better.
Inevitably there will
be clashes in the global name space even when you use namespaces. The
outermost namespace of every assembly is in the global scope and a name clash is always possible so there should be a mechanism of resolving them!
I've been developing in C# for over 4 years now and have never encountered a
single naming clash. But then I've never used (or seen anyone use) the
global namespace.

How would you create a namespaced proxy?


Create an assembly for each OEM assembly you want to wrap. In the namespace
of your choice (not global) create a class or classes that essentially
forward on the calls and data to the OEM assembly. Each of your proxy
assemblies will include only the OEM assembly that it is wrapping, hence no
conflict. Then, your app code uses your proxies and doesn't reference the
OEM assemblies directly. Problem solved.

But like I said, I've never had to give a second's thought to resolving
naming conflicts before today since I've never come across one, so there
might be a trivial solution out there.

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton
Nov 17 '05 #4
"anders" <an****@discussions.microsoft.com> schrieb im Newsbeitrag
news:1E**********************************@microsof t.com...
I already asked this question in the VB.NET group but as C# seems to have
the
same problem, I'll try here, too.

I have 2 external OEM assemblies A1 and A2 that both define class X (same
name, not same class) in the global namespace. I need to use both X'es in
my
project. How do I fully qualify the X'es to avoid the name clash between X
from A1 and X from A2.

The using statement provides a way of aliasing clashing names from named
namespaces but it does NOT give the possibility to resolve name clashes in
the global namespace. Or is it possible?

Any bright minds out there who have a solution?

Otherwise, this seems to be a serious problem with .NET languages. I hope
somebody from Microsoft sees this and gets this problem fixed.

Yes, anybody from Microsoft saw it, and it will be fixed in VS2005/C#2.0 ;-)

Christof
Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

88
5055
by: Tim Tyler | last post by:
PHP puts most of its functions into a big flat global namespace. That leads to short function names - but creates a namespace minefield for programmers. Lots of the functions are legacies from...
12
1980
by: Santiago de Compostela | last post by:
Hi The following program doesn't compile on MS VC++ or Bloodshed Dev-C++ #include <iostream> int strlen(const char *in) {
4
7096
by: Dan Elliott | last post by:
Hello, Converting from a working C program to C++, I run into the following error: I have a header: (header.h) namespace shared{ ... struct X{ ...
2
7500
by: Tony Johansson | last post by:
Hello! I'm reading a book about C++ and there is something that I don't understand so I ask you. Below I have the text from the book and the code from the file where main is located and some...
3
1475
by: seberino | last post by:
At top of a module I have an integer like so... foo = 4 In a function in that module I know I need to do 'global foo' to get at the value 4. .... IIRC, for dictionaries you DO NOT have...
5
3570
by: george r smith | last post by:
In the MSDN documentation there is a reference to "the global scope". For example "You can declare types directly in the global scope." I have search extensively and can not find a definition of...
18
2927
by: robert | last post by:
Using global variables in Python often raises chaos. Other languages use a clear prefix for globals. * you forget to declare a global * or you declare a global too much or in conflict * you...
3
2609
by: mrstephengross | last post by:
Hi folks. I've got a weird situation--gcc doesn't like the folllowing code snippet, but I don't know if it's correct or not. Here's the situation: In the global namespace, I've got a operator<<...
1
29312
weaknessforcats
by: weaknessforcats | last post by:
C++: The Case Against Global Variables Summary This article explores the negative ramifications of using global variables. The use of global variables is such a problem that C++ architects have...
3
1869
by: taps128 | last post by:
I've been reading the namespace specification for the 5.3 relaese, and I can't stop thinking that they have complicated the thing unecessary. Here is what I mean. So far if you call a function...
0
7233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7135
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7342
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7410
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7067
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5650
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5060
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3201
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.