Is VB Caca??

  • Thread starter Thread starter Don
  • Start date Start date
Cor Ligthert said:
It does not compare, I checked it although I know it would not, but as you
know you never use it in C#.

My point is that I like the way it is done in VB.Net and in my eyes.
VB.Net is the start of a new generation of programming languages. While C#
is the end of the C generartion. As forever people need time to get use to
it, but I have the believe that it will be like that as soon as the
shorter develop time becomes also vissible at management level. (And again
I don't see it as a successor from VB6, it adopted only some good things
from that although it took much more from C++)

The code I made for C# which is exactly the same in VB.Net, will not
compile in C#, while I don't understand why and can only see legancy
impossibilities.

What exactly won't compile? As Tom said, C# doesn't (IMO unfortunately)
automatically initialize variables of value types.
 
Herfried,

I would be glad if it would compile in C#, I am not doing only VB.Net you
know.

Cor
 
Scott said:
No, it's not. In VB.NET, as soon as you move your cursor off the current
line, the dynamic compilation feature of the language/VS.NET will check the
code on that line for syntax and compile errors and you will get the
infamous "blue wavy underline" right away.

Yes. That's how it works in C# too. Only as it's not line based, it will
also do the check if you pause for a second while typing a line.
In C#, you must build your code to get the same syntax checking. C# is not
dynamically compiled like VB.NET is.

In Visual Stuido 2005 it is.
It's too bad, because it's really the main reason I haven't move to more
development in C# yet.

I see a move coming up... :)
 
Göran Andersson said:

Yep, but that's not supported in the completeness it's supported in VB. For
C#, only a simple syntax check is performed, but VB's background compiler
detects far more errors.
 
Cor,

Cor Ligthert said:
I would be glad if it would compile in C#, I am not doing only VB.Net you
know.

You cannot expect C# to behave the way VB does and vice-versa. If this was
the case, we would only need a single .NET programming language.
 
Addendum:

Sample:

\\\
string s;
s = s.ToUpper();
///

For C#, the warning will only be shown after compiling the project, whereas
VB's background compiler would detect immediately.
 
Cor said:
Goran

beside what Herfried wrote

A a very simple one, however is in my idea good maintanable
\\\
Dim x As Integer
While x < 10
x += 1
End While
///

\\\
int x;
while (x < 10)
{
x += 1;
}
///
As sample does not go,while it is very handy.

(Or maybe is there a setting I don't know)

Cor

Oh, I see.

What you are talking about is implicit initialisation of local
variables. I wouldn't use that in a deep scope anyway, as the variable
is only initialised when the method starts, not at the line where you
declare it.

Example:

Dim s As String
s = String.Empty

Dim i As Integer
For i = 1 To 10
Dim x As Integer
x += 1
s += x.ToString + ","
Next

This will not produce the string "1,1,1,1,1,1,1,1,1,1," but the string
"1,2,3,4,5,6,7,8,9,10,", as the value of x is retained outside of it's
scope. The variable is created and initialised when the method starts,
and the placement of the Dim statement only decides it's scope.

In C# the variable can not be initialised outside of it's scope, so you
can't have a situation where you use a variable that retains it's value
outside the scope.
 
It was my attempt to turn a potential language war thread into something
more along the lines of a discussion. I was hoping people would understand
that the language they use isn't the only one and their particular needs not
the needs of everybody.

When somebody writes that something is "easier" (say the UCASE() function)
one should consider that it is easier to them and perhaps easier to the
other people in their club but not easier to everybody. Following a
language-agnostic methodology is probably "easier" if one switches between
languages regularly.

It was my hope I could jump in before somebody claimed that VB.Net is new
and that C# is the end of a generation or suggested that people preferred
punch cards to disk drives because they are more portable (which of course
they aren't unless 2 GB of punch cards can fit on the end of a keychain) but
alas that has already been posted.

If I were to guess I'd say VB.Net is making inroads into the corporation
precisely because it isn't VB6.


Tony K said:
<snip>
 
Sounds like you have a case of diarrhea of the fingers to me. Seriously,
all that for an innocuous 11 word reply? And, then again for a one word
reply?
 
Yes. That's how it works in C# too. Only as it's not line based, it will
also do the check if you pause for a second while typing a line.

No, Göran it's not. Not nearly to the extent that it is in VB .NET.
In Visual Stuido 2005 it is.

Could be, I haven't played with 2005 (C#) too much yet. But in VS.NET 2003
it is most certainly not.
 
Scott M. said:
No, Göran it's not. Not nearly to the extent that it is in VB .NET.


Could be, I haven't played with 2005 (C#) too much yet. But in VS.NET
2003 it is most certainly not.

The same is true for 2005.

Robin S.
 
Scott said:
No, Göran it's not. Not nearly to the extent that it is in VB .NET.

You are contradicting yourself. Either it is, or it is not. If it is
not, the extent of it can not be compared to something that is, which
you just did.
 
Tom Leylan wrote:
Let me start with an example. Somebody asks "what do you think of Los
Angeles" and someone replies "the smog is pretty bad". The reply to that
guy shouldn't be "if you hate it so much why do you live in the United
States?" Why? Because LA is in fact smoggy. There are valid reasons for
living there anyway but that doesn't change the fact that it has a smog
problem.

That wasn't an accurate comparison, I guess. If I understood the posts
correctly, it was like someone saying: "Is L.A. a bad city?". And then
Göran responding "I don't care much about L.A. I must say, though,
that it's a huge leap from the city it was some decades ago".

Which makes it really natural to ask "why do you live here, them?".
And it's something that only Göran can answer, I guess... "Because I
have to"; "Because I'd like to see things from a different
perscpective"; "Because I can endure anything"; "Because there are
things here that I don't find anywhere else"; "Because I'm trying to
convince people to leave this city and come to Seatle with me"; Who
knows? I'm one who'd like to know why Göran, which seems to dislike VB
(.Net) hangs in here. Just that.

Everything in life doesn't have to come down to a language war. One can
like Java fundamentally yet program in VB.Net for economic reasons and
should be able to point out "that's odd" without being asked to leave a
public newsgroup.

Again, I don't think that was the case. I didn't see anyone (except,
maybe, Aaron Kempf) being asked to leave this ng.
The alternative to rational discussion is embodied in
"the cult of VB6 developer" where everybody must chant the same thing or be
branded a heretic. People have attempted to pull that nonsense here but I
believe the days of yelling "he's a witch" and having that work have
(thankfully) passed.

I feel sorry you see things this way. I don't think there's anyone
posting regularly here with the attitude of "chant the same thing or
you'll be branded herectic" (well, actually I must confess that
sometimes I see *you* doing that). Specifically, I never saw the "cult
of the VB6 developer" here (you may find it alive an kicking in the
appropriate VB "classic" newsgroup, not here). Nor I saw anyone trying
to "pull that nonsense" here, unless... Oh, I got it! You're talking
about Aaron Kompf! Ok, I agree with you...

Regards,

Branco.
 
Goran,

Part from your message
In C# the variable can not be initialised outside of it's scope, so you
can't have a situation where you use a variable that retains it's value
outside the scope.

already answered by me about 6 hours before you in my answer to Tom Shelton
We will probably see a lot of message which will show that the C# method
is better, but the same kind of message I have already read a while ago
about the punchcard which was better than the hard disk because it was by
instance better transportable.

Cor
 
Goran,

You surely should try VB.Net once.

There is some checking in C#, however for somebody who knows what VB.Net
does, it is really nothing.

As you have seen am I a not always a correct typer (but very quick), I
assume that I build a C# program at least 5 times more than a VB.Net
program.

Cor
 
Göran Andersson wrote:
Dim s As String
s = String.Empty

Dim i As Integer
For i = 1 To 10
Dim x As Integer
x += 1
s += x.ToString + ","
Next

This will not produce the string "1,1,1,1,1,1,1,1,1,1," but the string
"1,2,3,4,5,6,7,8,9,10,", as the value of x is retained outside of it's
scope. The variable is created and initialised when the method starts,
and the placement of the Dim statement only decides it's scope.

It's not true that x keeps its value outside it's scope. The scope is
the loop, therefore it lives *inside* the scope.

To all practical effects, in VB a variable gets its default value
(i.e., nothing, 0, false, etc) just upon declaration. The declaration
itself isn't considered an executable statement. Therefore, if the
variable is declared inside a loop, it will keep whatever value it was
last assigned between cicles (that is, the declaration itself won't be
"executed" between cicles).

On the other hand, any initialization you supply in the declaration
*is an executable statement*, and thus will be executed between loop
cicles. Thus, if you want a variable to be *reinitialized* at each
cicle, you must explicitly say so:

Dim S As String
For I As Integer = 1 To 10
Dim X As Integer = 0
X += 1
S &= X.ToString & ","
Next

This may seem odd to people that come from a language that doesn't
initialize the memory where the variables live in, but it becomes
quite natural when you understand it.

Sure, this can lead to less "pure" (whatever this means) uses:

Dim S As String
For I As Integer = 1 To 10
Dim X As Integer = X + 1
S &= X.ToString & ","
Next

But as mom used to say, you'll only know a language when you start to
figure out the slang...

HTH.

Regards,

Branco.
 
Branco Medeiros said:
I don't think there's anyone
posting regularly here with the attitude of "chant the same thing or
you'll be branded herectic" (well, actually I must confess that
sometimes I see *you* doing that).

I appreciate the thoughtful response but I find it unlikely that you've ever
seen me post anything like that.
 
Cor said:
Goran,

You surely should try VB.Net once.

I regularly write small pieces of code in VB.NET to try them out. Not
enough to notice any difference in the background compilation, though.
There is some checking in C#, however for somebody who knows what VB.Net
does, it is really nothing.

As you have seen am I a not always a correct typer (but very quick), I
assume that I build a C# program at least 5 times more than a VB.Net
program.

I do mostly web development. I don't even have to build it to run it.
 
Why do you keep coming with those irrelevant analogies? What does this
have to do with punch cards?

Besides, it was you who said that you missed this feature in C#, and I
am explaining to you why it's not implemented that way.
Goran,

Part from your message
In C# the variable can not be initialised outside of it's scope, so you
can't have a situation where you use a variable that retains it's value
outside the scope.

already answered by me about 6 hours before you in my answer to Tom Shelton
We will probably see a lot of message which will show that the C# method
is better, but the same kind of message I have already read a while ago
about the punchcard which was better than the hard disk because it was by
instance better transportable.

Cor
 
Back
Top