Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003
This is the forum to discuss the Wrox book Professional VB.NET 2003 by Bill Evjen, Billy Hollis, Rockford Lhotka, Tim McCarthy, Jonathan Pinnock, Rama Ramachandran, Bill Sheldon; ISBN: 9780764559921
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 26th, 2003, 05:23 PM
Registered User
 
Join Date: Dec 2003
Location: Houston, TX, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default The origin of the "DIM" keyword

OK, this is for beginners so I have a somewhat of a strange question. Regarding the DIM keyword, I have read that it is short for Dimension, as in making space for a variable in memory (as described on page 46 of the Beginning VB.NET 2nd Edition book). Also, I have read that it is short for the phrase "Declare In Memory".

I am curious which is correct or if we will ever know for sure.

Like I said, I am just curious, this is not critical stuff but does anyone know for sure?!?!

  #2 (permalink)  
Old January 3rd, 2004, 08:03 PM
Authorized User
 
Join Date: Jun 2003
Location: Cowes, IOW, United Kingdom.
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to JonathanC
Default


I believe that its from Dimension

Jonathan Crossland
http://www.jonathancrossland.com
  #3 (permalink)  
Old February 10th, 2004, 02:07 PM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, Dim originated from the word "Dimension" as it "dimensions" memory for the object.

  #4 (permalink)  
Old February 4th, 2009, 06:55 AM
Registered User
 
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dim key word

Quote:
Originally Posted by RGCook View Post
OK, this is for beginners so I have a somewhat of a strange question. Regarding the DIM keyword, I have read that it is short for Dimension, as in making space for a variable in memory (as described on page 46 of the Beginning VB.NET 2nd Edition book). Also, I have read that it is short for the phrase "Declare In Memory".

I am curious which is correct or if we will ever know for sure.

Like I said, I am just curious, this is not critical stuff but does anyone know for sure?!?!
thanq!!! for giving this data
  #5 (permalink)  
Old February 4th, 2009, 09:18 AM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Location: Fuquay Varina, NC, USA.
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

I've always understood it to mean dimension. Of course you can check the Wikipedia (http://en.wikipedia.org/wiki/Main_Page) and you'll probably get more information than you want to know.
  #6 (permalink)  
Old February 4th, 2009, 05:05 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,652
Thanks: 3
Thanked 141 Times in 140 Posts
Default

As one who was writing BASIC interpreters from 1973 through 1986, I can positively affirm that indeed it is short for DIMension. Just like REM is short for REMark. (I think that's still allowed even in VB.NET, for compatibility with ancient history.)

The original Dartmouth BASIC (yes, that's where the language came from...and did you know BASIC is an acronym? Beginner's All-purpose Symbolic Instruction Code. Want to bet that the name came before the acronym? I'll take the bet and give you odds) allowed only two kinds of names: A,B,C,A1,A2,...A9,B1,B2,...B9,...Z9 were all numbers. No distinction between integers and floating point. All math was done in floating point. And then A$,B$, C$, A1$,...Z9$ were all strings. You never had to DIM a standard variable (not even sure it was legal) because the name of course implied the type. You only used DIM to create arrays, and hence you declared the DIMension of the array.

As late as the 1980s, this kind of syntax was still the standard. The variable name implied the data type. By then, most BASICs had extended the names to many characters and the number of data types by adding different extensions. e.g., Value# was a floating point number, Index% was an integer, etc. I dunno if Visual BASIC [and yes, BASIC should always be capitalized, since it is (hah!) an acronym] was the first to start allowing DIM to specify a data type, as opposed to just an array size, or not. But certainly VB is the language that made this usage of DIM the standard.

********************

p.s.: Yep, I just checked in Visual Studio and not only is REM still accepted as equivalent to the ' for starting a comment, it's even recognized as soon as you type REM by turning to the comment coloring. (Note that if you use it on the end of a line, you have to precede it with a colon, as in
Code:
Dim foo As Integer : REM counts how many widgets we have
Now...anybody want a history of how strings were DIMensioned and the two rival factions and who won? <grin/>

p.p.s.: And who needs Wikipedia when you have a living fossil sitting right here? <grin style="sheepish" />

Last edited by Old Pedant; February 4th, 2009 at 05:08 PM.
  #7 (permalink)  
Old February 4th, 2009, 09:28 PM
Friend of Wrox
 
Join Date: Nov 2007
Location: Central Florida, USA.
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default Wonders never cease...

Bill you are truly a wealth (or is i well) of knowledge. Thanks for that complete history/definition. I for one learned quite a bit!
__________________
Jason Hall

Follow me on Twitter @jhall2013
  #8 (permalink)  
Old February 5th, 2009, 08:24 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,652
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Hey, guess what!

In answering another question, I had occasion to refer to the official "Microsoft Visual Basic .NET Language Specification", version 7.1, by Paul Vick.

And VB.NET *STILL* supports those magic suffix characters that predetermine the datatype!!!

Apparently, in fact, if you use those suffix characters then you don't even NEED to use a type name. Even when OPTION STRICT is on!

Hang on...let me check that...

YES!!!!

First of all, make sure you are compiling with OPTION STRICT ON (or use <%@ Strict="true" %> if building an ASP.NET page, for example).

Now add the code line:
Code:
Dim s = "test"
You will get a message like this:
Option Strict On requires all variable declarations to have an 'As' clause.

Okay, now change that to
Code:
Dim s$ = "test"
and rebuild. PRESTO! No error message!!!!!!!

Or try this
Code:
Dim s# = "test"
and receive the message "Option Strict On disallows implicit conversion from String to Double".

VOILA!

The complete list of "type character" suffixes supported in VB.NET is impressive:
Code:
%  == Integer
&  == Long [remember, in VB.NET, Long means 64 bits]
@  == Decimal
!  == Single [floating point, only 6 digits of accuracy...no point in ever using this]
#  == Double [floating point, 15+ digits of accuracy]
$  == String [as we've already seen]

In other words
    Dim somename% 
is IDENTICAL (in effect) to doing
    Dim somename AS Integer
except you must continue to use the name somename%
So... Nothing worth carrying around with you. Just interesting trivia and nostalgia and compatibility with bygone languages.
  #9 (permalink)  
Old February 6th, 2009, 09:01 AM
Authorized User
 
Join Date: Jan 2009
Location: thanjavur,india
Posts: 43
Thanks: 0
Thanked 2 Times in 2 Posts
Default from dinesh

hi old pedant, very interesting to read your posts. waiting for more from u.
  #10 (permalink)  
Old February 6th, 2009, 09:03 AM
Authorized User
 
Join Date: Jan 2009
Location: thanjavur,india
Posts: 43
Thanks: 0
Thanked 2 Times in 2 Posts
Default from dinesh

Quote:
Originally Posted by srivaniannapurna.solasa View Post
thanq!!! for giving this data

hi srivanianapoorna r u from tamilnadu...
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
What does (Me!) and (Dim)stand for in VBA Coding? srswedeen Access VBA 1 October 14th, 2005 07:41 AM
Can't DIM database object egolsen Access VBA 2 September 26th, 2005 05:25 PM
Dim Types in ASP? rmwalters2000 Classic ASP Basics 2 August 11th, 2004 01:28 AM
Dim dbs As Database Brian263 Access 1 May 6th, 2004 08:11 PM
Dim in VB.NET khautinh VB.NET 2002/2003 Basics 2 August 3rd, 2003 10:54 PM



All times are GMT -4. The time now is 10:37 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.