Monday, February 06, 2006 1:46 PM
<rant>
So I'm on a C# project right now, and actually am really enjoying working with the language! It's not the nasty beast I thought it would be, and the semicolons are growing on me. I ran into a bit of a snag the other day when I needed to check a value to see if its numeric. Hmmm...no IsNumeric function in C#. After asking around, I was pointed to a few different solutions like the parsing method of the integer data type or using a regular expression (which is what I went with).
Today, I wanted to use a with/endwith statement. Hmmm...not showing up in the intellisense. So I Google, sure that I'm just not using the right syntax (case sensitivity is something to get used to as well). I dig up the article below:
http://www.gotdotnet.com/team/csharp/learn/columns/ask.aspx#with
It explains that there IS no with/endwith construct within C#. Really. Now, I can accept this, since the reason there are different languages goes beyond different syntax to different features as well. But the explanation as to why they didn't include it got my blood pressure up.
Reason 1: Small or non-existent readability benefits.
Totally disagree with this one. With statements DO make the code MORE readable, cleaner, and less messy looking. Now, that's all a matter of opinion, but the statement the author makes that "I won't go as far to say that teh with statement makes code less readable, but some people probably would" does nothing but widen the divide between VB and C# devs. I'm sure alot of VB devs would agree with me.
Reason 2: Increased language complexity.
I can accept this. If they felt that the amount of work that would be required to put it in was too great for the ability to not type an object name a few times over, that's fine. The VB team did have to add extra things to make VB work with it, but hey: they DID it. If the C# team doesn't want to/can't because of fear that it would just screw up the progress of C#, that's fine though.
But then came reason 3...the most ludicris thing I've ever read...
Reason 3:Because C++ has never had a with statement, and C++ devs don't have a problem with not having it.
I thought we were talking to C# developers here, not C++. And in fact, there's probably a greater chance that a VB developer would have to jump into C# before a C++ dev would. So why not cater to your two main markets: C# devs and VB devs that have to straddle the fence?! VB people would LOVE to have access to the same constructs in C# as they would in VB, but to say that the DESIGN DECISION was based on how C++ people felt? Wow. Is there that great a divide between the language teams?
Ok, I'm done.
</rant>