|
Writing CLS-compliant means, among other things, no underscores in variable names, no unsigned integers and case insensivity in naming. Do you bother?
Notice the text in bold - "among other things"
Nish
|
|
|
|
|
oh I noticed it, but have never seen--out right--naming conventions be included in cls compliance, is all.
/bb|[^b]{2}/
|
|
|
|
|
CLS compliant code must work with all first class .NET languages. VB.NET, for example, isn't case sensitive and uses "_" as a special character so you have to be careful with naming your accessible entity names. Private and internal names you don't have to worry about.
cheers,
Chris Maunder
|
|
|
|
|
I think that why private method's name should begin with '_', like : _InitTab ! Then the external interface : calculate... That make more sens
Kochise
In Code we trust !
|
|
|
|
|
Chris Maunder wrote:
CLS compliant code must work with all first class .NET languages. VB.NET, for example, isn't case sensitive and uses "_" as a special character ...
There's the proof, VB is a second class language.
Chris Meech
I am Canadian. [heard in a local bar]
Remember that in Texas, Gun Control is hitting what you aim at. [Richard Stringer]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
Chris Meech wrote:
There's the proof, VB is a second class language.
As others have pointed out, this is not a problem caused by VB. There goes your proof.
|
|
|
|
|
That begs the question though, why did Microsoft design a framework that way to begin with? It wouldn't have been difficult to have similar requirements for variable/function naming across languages. With the possible exception of Managed C++, the .NET languages are all either brand new or redesigns anyway, so it's not like there's any backward compatibility issues. I guess what I'm saying is, VB.NET is vastly different from VB6 anyway, why not go on and make its variable naming similar to C# and company?
The generation of random numbers is too important to be left to chance.
|
|
|
|
|
Navin wrote:
so it's not like there's any backward compatibility issues.
You didn't follow all the discussions in .NET 1.0 about the changes made in VB.NET to ensure compatibility with VB6 code?
cheers,
Chris Maunder
|
|
|
|
|
Isn't it still non-trivial to port something from VB6 to VB.NET?
The generation of random numbers is too important to be left to chance.
|
|
|
|
|
Chris Maunder wrote:
VB.NET, for example, isn't case sensitive and uses "_" as a special character
True, underscores are used as line continuation characters in VB.NET.
However, variable and function names are allowed to contain underscores too. Example: "m_myMemberVariable", "_anotherVariable".
I'm not sure where this restriction has come from, but I don't think it's from VB. It would be interesting to find out though.
|
|
|
|
|
Note that in C and C++, identifiers starting with _ or __ are reserved. Not that you can't get away with it a good portion of the time, but you really shouldn't try... because someone might come along and add extensions of some sort to their compiler and class lib, and suddenly your code has collisions all over the place...
Medication for us all
You think you know me, well you're wrong
|
|
|
|
|
Gosh.. always thought it's just the __ identifiers, which are reserved..
But in this case I may be wrong.. think some guru's always used _ for private variables.. but I don't know.
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects." Roger Wright http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xx
|
|
|
|
|
Gosh.. always thought it's just the __ identifiers, which are reserved..
But in this case I may be wrong.. think some guru always used _ for private variables.. but I don't know.
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects." Roger Wright http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xx
|
|
|
|
|
I dont get it. If i write code in C# and then compile it, how is this ever going to impact on VB.Net?
[worldspawn]
|
|
|
|
|
Imagine the small chance that you write some classes that you want other developers to use. These developers find your classes very usefull. Among these developers are some VB.NET programmers. They would not be able to use your class if it's not CLS compliant.
In general, I don't think that one should bother too much about writing CLS compliant code. The most code you write isn't going to be reused anyway. But for the classes that tend to be reusable, the CLS standard should be considered.
I also got the blogging virus..[^]
|
|
|
|
|
OK makes sense. I tried putting [assembly:CLSCompliant(true)] in my code and it told be pretty much everything in my assembly was not compliant. But thats all it told me ("it" being the cs compiler). How are you supposed to know why your code is not CLS Compliant?
[worldspawn]
|
|
|
|
|
|
MadHatter ¢ wrote:
but since internals are often renamed
The internals don't matter here, CLR compliance refers only to what you expose publicly in your assembly.
Regards
Thomas
Disclaimer: Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.
|
|
|
|
|
I've been working on a Trunk Monkey add in to the .NET compilier. it detects crappy naming conventions and the monkey pops out and beats the developer over the head until they promise to not write ugly code...
I can see that becomming a huge *hit* .
/bb|[^b]{2}/
|
|
|
|