misc >> a%, a$, a# vs dim a as datatype

by gswork » Mon, 05 Dec 2005 18:55:19 GMT

just a question for basic programmers

do you like to seperate the name of the variable from its type?

e.g.

DIM a AS INTEGER, b AS DOUBLE, c AS STRING

in QB and various other MS BASIC derived / comparable BASIC languages
or

dim a%, b#, c$ (or whatever symbols get used to represent type)

in what i refer to as 80's line number 8 bit BASICs and various BASICS
around now (e.g. Blitzbasic (iirc), Basic4GL and others

i have a very strong preference for the former, so much so that i
prefer not to use BASIC's that depend on symbols appended to variable
names to denote type. I just think it's cleaner and more in paralell
with other language syntax. I believe others find the symbols a
handy reminder of type when reading code though.


misc >> a%, a$, a# vs dim a as datatype

by Judson McClendon » Tue, 06 Dec 2005 03:51:16 GMT


Most programming languages do not attach a variable class identifier (e.g.
#,!,%) to the variable name as BASIC does. Perhaps because I program in many
other languages, I do not see it as necessary. In my opinion, you have no
business doing anything with a variable unless you know what it is, and that
certainly means what type of variable it is! In cases where a variable may
be in more than one form, say as a string and an integer, I often prefix or
suffix the variable name with 'str' or 'int' to distinguish between the two.
--
Judson McClendon XXXX@XXXXX.COM (remove zero)
Sun Valley Systems http://sunvaley.com
"For God so loved the world that He gave His only begotten Son, that
whoever believes in Him should not perish but have everlasting life."

misc >> a%, a$, a# vs dim a as datatype

by rhnlogic » Tue, 06 Dec 2005 07:08:02 GMT


Although the latter is more modern and more flexible, the
former, with type implicit in the variable name, is in many
of the earliest implementations (the 4th version and onwards
of Kemeny and Kurtz's Dartmouth BASIC, Altair Basic, etc.),
as well as in the original BASIC language standards (ISO
and ANSI, both minimal and full versions).

So I prefer support for both forms at best, and the latter
implicit form for minimal BASIC implementations.


IMHO. YMMV.