473,623 Members | 2,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Namespace aliases notation, why the difference

Hi,

Why do the 2.0 namespace aliases use the "::" notation where before the
namespaces used dot notation ".".

Ie.,

using IO = System.IO;

IO::Blah.Blah() ..

instead of...

IO.Blah.Blah(). ..
Why why why the differnce?

Nov 15 '05 #1
4 1501
di********@disc ussion.microsof t.com wrote:
IO::Blah.Blah() ..

instead of...

IO.Blah.Blah(). ..


I sure hope that's optional. Are there any other C++ conventions being
foisted upon us in 2.0?

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 15 '05 #2
I noticed it in the PDC powerpoint presentation TLS320_Hejlsber g.ppt

from microsoft.com/pdc homepage

I think its going to cause confusion if it is to be like this.

"Frank Oquendo" <fr****@acadxpi n.com> wrote in message
news:eu******** ******@TK2MSFTN GP11.phx.gbl...
di********@disc ussion.microsof t.com wrote:
IO::Blah.Blah() ..

instead of...

IO.Blah.Blah(). ..


I sure hope that's optional. Are there any other C++ conventions being
foisted upon us in 2.0?

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)

Nov 15 '05 #3
di********@disc ussion.microsof t.com wrote:
I think its going to cause confusion if it is to be like this.


As do I. The C# development team made a big todo about the simplicity of
scoping operators. I'd hate to see them backtrack on that if it yields
no material gain. Switching to '::' just because they can would be a bad
move.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 15 '05 #4
One of the problems that people ran into was that there was no way to say "I
mean this type, really!". If you wrote something like:

System.Console. WriteLine()

and you had something named "System" in scope, you had to resort to aliases,
which is unsightly. It's especially bad if you're generating code, as
there's no easy way to know when the situation might come up.

For 2.0, you can write:

global::System. Console.WriteLi ne()

and know that you're really dealing with System.Console. WriteLine.

We also allow you to define an alias for something else (like IO below), and
use it in a similar manner.

We expect that the use of these will be rare.

--
Eric Gunnerson

Visit the C# product team at http://www.csharp.net
Eric's blog is at http://blogs.gotdotnet.com/ericgu/

This posting is provided "AS IS" with no warranties, and confers no rights.
<di********@dis cussion.microso ft.com> wrote in message
news:O$******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

Why do the 2.0 namespace aliases use the "::" notation where before the
namespaces used dot notation ".".

Ie.,

using IO = System.IO;

IO::Blah.Blah() ..

instead of...

IO.Blah.Blah(). ..
Why why why the differnce?

Nov 15 '05 #5

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

Similar topics

4
1797
by: test1dellboy3 | last post by:
Hi, I am a beginner using the python interpreter. To reduce typing effort, I created a module called "aliases.py" containing some aliases for objects I commonly use like - aliases.py : import filecmp, os, commands
3
4371
by: Robert Mark Bram | last post by:
Howdy All! Is there any difference between referencing objects and attributes with dot notation or bracket notation? Example, document.formname.controlname document Can I access attributes and objects equally with both?
5
2815
by: Joe Bloggs | last post by:
Hi, I would like to programatically resolve aliases to the actual type, eg. int to System.Int32. Essentially, I would like to do this: Type t = Type.GetType(ResolveAlias("int")); if (t == typeof(System.Int32))
11
3906
by: alex sparsky | last post by:
I have a rather unique problem that I need some advice on. I have multiple c# controls that need to make use of a common namespace. So when I go to include both controls that make use of that common namespace and one control has a newer version of that namespace, the compiler complains about ambiguous references. I've tried using compiler directives to manipulate the namespaces to be different at compile time but vs.net 2005 keeps...
4
3782
by: Paul E Collins | last post by:
I'm using mysql_fetch_array to run a query along these lines: SELECT A.name, B.name FROM A, B WHERE A.id = B.id I tried this code: while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo $row; }
22
4212
by: mp | last post by:
i have a python program which attempts to call 'cls' but fails: sh: line 1: cls: command not found i tried creating an alias from cls to clear in .profile, .cshrc, and /etc/profile, but none of these options seem to work. my conclusion is that a python program that is executing does not use the shell (because it does not recognize shell aliases). is this correct?
22
2052
by: Daniel Rucareanu | last post by:
I have the following script: function Test(){} Test.F = function(){} Test.F.FF = function(){} Test.F.FF.FFF = function(){} Test.F.FF.FFF.FFFF = function(){} //var alias = function(){}; var alias = Test.F.FF.FFF.FFFF;
3
1814
by: toton | last post by:
Hi, Is it possible to have a class level namespace opening instead of file level . Something like this, I have a long namespace like namespace com { namespace my_company{ namespace my_project{ namespace parser{ class my_parser{ };
11
2537
by: Chris Thomasson | last post by:
I was thinking of how I was going to create a robust versioning system in Standard C++ for my library and was wondering exactly what the point of a namespace alias is? The seem like a rather limited approach. For instance, you simply cannot "add-on" to a aliased namespace... Here is a quick example of what I am talking about: __________________________ #include <stdio.h>
0
8231
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8168
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8672
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8471
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6107
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4075
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1474
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.