Z
Zytan
It's part of an idiom. If you don't want to use the idiom, then don't
Ok, so it's an idiom. An expression whose meaning cannot be deduced
from the literal definitions and the arrangement of its parts. This
explains it. Thank you.
I didn't have a problem with it, until I found out that "New" is
hidden. But, now that I realize hiding "New" always happens, it's ok.
Agreed. Like I said, I can 'see' how the shortcut is 'ok'. I really
had no problems with it. Probably because of the lack of ambiguity,
as you said. Very well put.
Ok, now that i know VB hides "New" all the time, I don't mind the lack
of "New" in the above anymore, especially now that I know what is
going on. If it consistently hides "New", that everything is fine.
But, yes, I dislike the inconsistancy as you mentioned above, as
well. Im glad to know I am not going crazy, but others have had these
thoughts, too.
Ok.
Much thanks for your indepth reply.
Zytan
(but, as others have said, consistency matters, so be consistent in
not using it).
Ok, so it's an idiom. An expression whose meaning cannot be deduced
from the literal definitions and the arrangement of its parts. This
explains it. Thank you.
As Tom pointed out in another post, no one seems to have a problem
with ...
Dim A As String = "xyzzy"
Or ...
Dim A As String
A = "abracadabra"
... even though there's an implicit New somewhere (during
initialization).
I didn't have a problem with it, until I found out that "New" is
hidden. But, now that I realize hiding "New" always happens, it's ok.
This is an interesting example, because it touches the notion that
VB.Net is idiosyncractic because of its many hystorical VB'isms.
Ironicaly, to a seasoned VB.Classic programmer, the "Dim X As New Y"
construct would be a very definitive *no*, because of the way it used
to work previously to VB.Net and the kind of code it generated. Yet,
in VB.Net it's a popular idiom and one that I -- even being a
"seasoned" VB programmer -- recommend, because there's *no* semantic
ambiguity in the short circuit. Personally I'd even recommend you not
using the "complete" syntax, due to verbosity.
Agreed. Like I said, I can 'see' how the shortcut is 'ok'. I really
had no problems with it. Probably because of the lack of ambiguity,
as you said. Very well put.
I, personaly, really *abhor* the "New X() { ... }" syntax... *sigh*
(of course, no one has to condone my personal grievances).
The short circuit syntax seems perfectly clear to me and I am glad
it's clear to the compiler also. What I think is inconsistent is that
this short circuit can't be used outside a Dim (just as with strings):
Dim Args() As Integer
Args = {...}
Ok, now that i know VB hides "New" all the time, I don't mind the lack
of "New" in the above anymore, especially now that I know what is
going on. If it consistently hides "New", that everything is fine.
But, yes, I dislike the inconsistancy as you mentioned above, as
well. Im glad to know I am not going crazy, but others have had these
thoughts, too.
I suggest you experiment with the short circuit in some of the next
snippets you'll have to produce. Or in the next project you'll start.
After using the short circuit in some real situations you'll be able
to decide if it's part of your vocabulary or not.
Ok.
Much thanks for your indepth reply.
Zytan