|
I dont see how you COULD write case insensitive code in C# or VC++
|
|
|
|
|
Case insensitivity means not having two identifiers in the same scope whose name differs only in case. It's easy enough to do this in the C-family languages and it's generally recommended anyway.
Kevin
|
|
|
|
|
My VB projects follows these rules:
1) Private vars with class scope:
Private mVarName As String
2) The properties that access them:
Public property VarName() As String
3) Vars with narrow (function level) scope
Dim varName As Integer
Never had a case of being confused....
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
My Blog[^]
|
|
|
|
|
Ray Cassick wrote:
Never had a case of being confused....
For once, this was not a VB bash. The problem I have is that the way I case variables, I am not CLS compliant. Because if I need a scratch variable, I am likely to do this:
Bitmap bitmap = CallSomeFunction();
And I can't do that, because VB is crap and does not recognise case. Oops, I guess it does relate to VB....
It also means I can't do properties like this:
Bitmap sourceImage;
public Bitmap SourceImage
{
get
{
return sourceImage;
}
}
For example.
Casing is one more place where VB won't hurt a disciplined programmer, but helps idiots write unreadable spagetti.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I don't write dot net code, but I have been using underscore for my local variables for the longest time!
It seems like the rest of the industry is slowly catching up with me
|
|
|
|
|
Hate to break it to your exclusive future but: CLS-compliant means, among other things, no underscores in variable names
regards,
Paul Watson
South Africa
PMW Photography
Gary Wheeler wrote:
It's people like you that keep me heading for my big debut on CNN...
|
|
|
|
|
From what I read in this forum, it seems that this rule only applies to the public interface, does it not ?
So, my "local variable" have a even more "private" scope than the private attributes, for they are allocated on the stack, quite invisible from the interface standpoint.
|
|
|
|
|
Hope you don't write C++ code...
Medication for us all
You think you know me, well you're wrong
|
|
|
|
|
Sure I write C++ code, and nothing else much.
Why wouldn't I ?
|
|
|
|
|
When I was developing .NET code, I used to run FxCop[^] before each check-in to VSS, and FxCop reports any non CLS-compliant code. However, it seems I was the only one in the office that practiced this
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Me: I recommend we use FxCop for our projects.
Co-worker (not CP): I think I saw that movie once.
Me: Yeah, bad ending though eh?
regards,
Paul Watson
South Africa
PMW Photography
Gary Wheeler wrote:
It's people like you that keep me heading for my big debut on CNN...
|
|
|
|
|
Nemanja Trifunovic wrote:
FxCop reports any non CLS-compliant code.
You mean the CLSCompliant attribute is not enough?
Regards,
Alvaro
Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is. -- GWB, 1999.
|
|
|
|
|
It is. Actually, what FxCop does is report an error if CLSCompliant attribute is missing and then leaves the actual enforcement of CLS compliance to the compiler.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Running code through FxCop is a really bad way to start the day. "I don't like your naming convention", "get rid of that underscore", "why are initialising that value to null you idiot", "I don't like it when you contract string to str"
OK, OK - I'll fix it. Sheesh.
cheers,
Chris Maunder
|
|
|
|
|
The first time I ran it and it came back with over 100 errors, I thought about changing careers.
Jeff Martin
My Blog
|
|
|
|
|
I write cls compliant code (as much as possible given the particulars of the project), but since internals are often renamed, why dones internal naming conventions make code "CLS" or "NON-CLS"? to me writing cls compliant code is writing code which complies to the standards of the common runtime language, not a common naming convention...
/bb|[^b]{2}/
|
|
|
|
|
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.
|
|
|
|