VB - trivial improvements

  • Thread starter Thread starter guy
  • Start date Start date
G

guy

Just a though but three trivial changes which I would like to see in VB:-
1- Make Null a synonym for Nothing, progressively phasing Nothing out, you
have to know null anyway so why not use it in VB?
2- Use Dec or Declare to declare non array variables where currently we
would use Dim. Dim is a fudge, as we are not 'dimensioning' anything.
3- Allow the '++' / '--' style syntax for incrementing / decrementing a
number. It is a simple concise shorthand.

any thoughts?

Guy
 
Guy,

Do you know what Null means, it is an very ancient use for not the basic
instancing of bytes in memory with all zero bits. Not all, on others is used
all "F" bytes.

This legancy is used in C type languages to tell that there is Nothing
referenced, for me it is the same as calling fuel for an engine still coals.

This the same for the incrementer, the simple form of VB were you can say

For i = 0 to X

seems to me more easy then

for(int i = 0;i < X;i++);


However if you want to replace the Dim (what I don't want, I want it
optional), why than not use the "var" as it is recentely introduced in C# to
have the (not complete) same behaviour as the Dim in C#.

If you want to use legancy behaviour from C type languages, then use those.

Just my opinion.

Cor
 
Cor Ligthert said:
Guy,

Do you know what Null means,

yes I do
..
This the same for the incrementer, the simple form of VB were you can say

For i = 0 to X

seems to me more easy then

for(int i = 0;i < X;i++);

totally agree
However if you want to replace the Dim (what I don't want, I want it
optional), why than not use the "var" as it is recentely introduced in C# to
have the (not complete) same behaviour as the Dim in C#.

yes Var would be fine
If you want to use legancy behaviour from C type languages, then use those.

Just my opinion.

Cor
Snip

Guy
 
guy said:
Just a though but three trivial changes which I would like to see in VB:-
1- Make Null a synonym for Nothing, progressively phasing Nothing out, you
have to know null anyway so why not use it in VB?

Agreed. Can't see any harm in this one.
2- Use Dec or Declare to declare non array variables where currently we
would use Dim. Dim is a fudge, as we are not 'dimensioning' anything.

I would rather see "Private" permitted within a method body (as they are
outside of one) and "Dim" pushed aside, into Obsolescence. This could
also eliminate Dim's ambiguous behaviour (e.g. Module level variables in
Classes & Modules).
3- Allow the '++' / '--' style syntax for incrementing / decrementing a
number. It is a simple concise shorthand.

Agreed, although this may be more contentious if [and when] other
language features are introduced:

(a) Operator Overloading
What does "++" mean to some complex class?

(b) Pre- & Post- Increment Operators
Even if you /can/ increment an object, will we have to worry about the
likes of "++ i" and "i ++" (I'm assuming you know the difference).

Regards,
Phill W.
 
guy said:
Just a though but three trivial changes which I would like to see in
VB:-
1- Make Null a synonym for Nothing, progressively phasing
Nothing out, you have to know null anyway so why not use it in VB?
2- Use Dec or Declare to declare non array variables where currently
we would use Dim. Dim is a fudge, as we are not 'dimensioning'
anything.
3- Allow the '++' / '--' style syntax for incrementing /
decrementing a number. It is a simple concise shorthand.

any thoughts?

I disagree completely.

1) If a variable points to nothing, why not call it "Nothing"? Why
"Null"? "Null" can easier be confused with DBNull than "Nothing" can be.

2) "dimension" means "size" here. By specifying the type, you implicitly
specify the size, i.e. the dimension of the value. Historic reasons.
Therefore Dim is not wrong. There have been discussions about it so I
won't add anything to it. There is no need to change it. Really.

3) i += 1 is short enough. Better than meaningless, non-human, C style
letter chaos. "++"? Doesn't it increment by two? I see two plus signs.
"i++"? Where is the assignment? You at least need a "=" to assign a
value. (Don't explain, I know..)


Armin
 
guy said:
Just a though but three trivial changes which I would like to see in VB:-
1- Make Null a synonym for Nothing, progressively phasing Nothing out,
you
have to know null anyway so why not use it in VB?

Which problem would be solved by this change?
2- Use Dec or Declare to declare non array variables where currently we
would use Dim. Dim is a fudge, as we are not 'dimensioning' anything.

Which problem would be solved by this change?
3- Allow the '++' / '--' style syntax for incrementing / decrementing a
number. It is a simple concise shorthand.

Read:

Why not ++ and --?
<URL:http://www.panopticoncentral.net/archive/2003/12/02/251.aspx>
 
guy said:
Just a though but three trivial changes which I would like to see in VB:-
1- Make Null a synonym for Nothing, progressively phasing Nothing out, you
have to know null anyway so why not use it in VB?
2- Use Dec or Declare to declare non array variables where currently we
would use Dim. Dim is a fudge, as we are not 'dimensioning' anything.
3- Allow the '++' / '--' style syntax for incrementing / decrementing a
number. It is a simple concise shorthand.

any thoughts?

Guy

I don't see how this benefits someone learning VB. It may help someone
coming from C# but picking up these going C# -> VB.Net is not difficult by
any means. I think giving choices hurts those migrating VB6 -> VB.Net, which
seems to be the more common migration path.
 
Herfried K. Wagner said:
Which problem would be solved by this change?

Just consistency with the Framework documentation - how often do we see
.... null (or Nothing in VB) ...
Which problem would be solved by this change?

Dim was always used to dimension arrays, now its meaning has changed to
declaring a variable, it just doesnt read right (to me)

Interesting article! maybe instead of ++ -- we could have a Inc(rement) and
Dec(rement) statements, which would avoid majic numbers in loops etc.Guy
 
guy said:
Just consistency with the Framework documentation - how often do we see
... null (or Nothing in VB) ...

That's true, but I do not think this is a problem at all.
Dim was always used to dimension arrays, now its meaning has changed to
declaring a variable, it just doesnt read right (to me)

The meaning of 'Dim' has changed already a long time ago. I never had a
problem to understand what 'Dim' does. It's more a symbol than a meaningful
word.
Interesting article! maybe instead of ++ -- we could have a Inc(rement)
and
Dec(rement) statements, which would avoid majic numbers in loops etc.

'i += 1' isn't a "magic" number. It's clear that the number is incremented
by one. I do not see any advantage of 'Dec' and 'Inc' statements over
'... -= 1' and '... += 1'.
 
Family Tree Mike said:
I don't see how this benefits someone learning VB. It may help someone
coming from C# but picking up these going C# -> VB.Net is not difficult by
any means. I think giving choices hurts those migrating VB6 -> VB.Net,
which
seems to be the more common migration path.

I agree with you. However, the IDE could assist those coming from other
programming languages by expanding 'i++' to 'i += 1'.
 
guy said:
Just consistency with the Framework documentation - how often do we
see ... null (or Nothing in VB) ...

So why not change the documentation? ...Nothing (or Null in ...)...
;-) (_One_ "ghost driver"[1]? Many!)


Armin
[1] "ghost driver" is what we call a <quote>motorist driving against the
traffic on motorways</quote> (source: dict.leo.org)
 
guy said:
Just a though but three trivial changes which I would like to see in
VB:- 1- Make Null a synonym for Nothing, progressively phasing
Nothing out, you have to know null anyway so why not use it in VB?

How about Void? A void is a nothingness...
2- Use Dec or Declare to declare non array variables where currently
we would use Dim. Dim is a fudge, as we are not 'dimensioning'

Or Var... seeing as that's what ECMAScript uses. Or just drop it and program
the compiler to use whatever comes before As as a New variable name.
anything. 3- Allow the '++' / '--' style syntax for incrementing /
decrementing a number. It is a simple concise shorthand.

Well, as has been pointed out, due to the multiplicity of the symbols, it
might appear that you want to increment/decrement by two rather than one.
Also, it might confuse people who are used to seeing ** mean ^. How about
just a single + or -?

Andrew
 
Just a though but three trivial changes which I would like to see in VB:-

The thing I miss the most in VB is macros (#define) including the
stringizing operator (#) and the token pasting operator (##). Macros are
easily abused and overused, but I like them.
 
Herfried K. Wagner said:
That's true, but I do not think this is a problem at all.

except that even though I program almost exclusively in VB i still keep
typing:-
If thing is null

no idea why except that the framework always uses null, as des Swl Server...
The meaning of 'Dim' has changed already a long time ago. I never had a
problem to understand what 'Dim' does. It's more a symbol than a meaningful
word.

exactly my point, so why not use a meaningfull word instead?
'i += 1' isn't a "magic" number. It's clear that the number is incremented
by one. I do not see any advantage of 'Dec' and 'Inc' statements over
'... -= 1' and '... += 1'.

It is probably because I come from an assembler background (a million years
ago!)
and you always used inc and dec rather than Add(1)

cheers

Guy
 
Hello guy,
except that even though I program almost exclusively in VB i still
keep
typing:-
If thing is null
no idea why except that the framework always uses null, as des Swl
Server...

By this logic we should replace 'End Sub', 'End Function', 'End Using' and
others with '}' simply because some people find it easier or type it by habit.

Those of us who have been using VB since VB6 or before are quite used to
'Nothing'.
the framework always uses null

No it doesn't. The framework interprets IL which is compiled from whatever
language the compiler in question was given at the time of compilation. Thus
the Framework uses 'Nothing' or 'Null' or 'Wibble' if that's what the language
happened to specify.

Your whole arguement appears to be..."let's improve VB by making it more
like C#".

If you were talking about adding feature(s) which were not "easily" simulated
from one language to the other I could understand.

For example the addition of "Using" to the VB language was IMHO a useful
addition as it reduced noise.

But introducing a new keyword in VB which is an exact duplicate of an already
existing keyword and logically only helps users of another language is way
over the top.

Again this is only one opinion.
 
I would rather favor adding new keywords to support new features rather than
changing existing keywords IMO doing more arm than anything else...
 
However if you want to replace the Dim (what I don't want, I want it
optional), why than not use the "var" as it is recentely introduced in C# to
have the (not complete) same behaviour as the Dim in C#.

What do you mean by this comment? var was introduced to preserve the C#
style of declaration and support anonymous types. var is more of a type
place holder, like T in a generic declaration than a synonym to the dim
keyword.
 
Tom,

Santa Claus is in Holland at 5 december in the USA they have taken this
connected to Christmass. In Holland he is still using his bishop clothes
and in the USA that is translated to a kind of Dutch sailor with clothes
from Lapland, while in Holland he comes from Spain and in the USA from the
northpool.

Kids both in Holland and the USA are happy with this.

In fact is

dim a = "1"
the same as
var a = "1";

As you 've showed me so nicely some time ago.

As you want to call this anonymous, be happy with it, that is Santa Claus as
well.

Cor
 
Back
Top