[Coco] What are the rules for naming basic09 variables ?
Wayne Campbell
asa.rand at gmail.com
Sat Jul 27 19:51:46 EDT 2019
I will have to dig out my Basic09 reference and look again. I could swear
it says variable names are limited to 29 characters, but I could be
mistaken. It's been awhile since I read the manuals. It could be you're
correct, because Basic09 replaces text names with 3-byte references. Before
packing it keeps a list of variable names for displaying the source
statements in the editor. I am still trying to understand the format of the
lists that Basic09 creates when it loads source code.
On Sat, Jul 27, 2019, 4:16 PM <coco at jechar.ca> wrote:
> On 2019-07-27 19:01, Gene Heskett wrote:
> > On Saturday 27 July 2019 04:44:14 Gene Heskett wrote:
> >
> >> On Friday 26 July 2019 16:21:58 Wayne Campbell wrote:
> >> > Up to 29 characters, 0-9, a-z, A-Z, _
> >>
> >> I think its 28 active, to make room for the terminating zero of the
> >> string.
> >>
> > I was mistaken, it is 29, with D7 set in the last character, high bit
> > set
> > IOW.
> >> > $ only if a string variable, only as last character of the variable
> >> > name. Not sure, but I think first character has to be a letter?
> >> >
> Actually I was surprised to see that even 40 characters is not too many
> and
> that two variables can be distinguished I tried several things and made
> comments
> out of the errors. See listing below. Add to it as you like and re-post.
>
> PROCEDURE vname
> (* Development test program *)
> DIM TI:STRING
> (* DIM ti:STRING cannot be declared as basic09 is case insensitive & TI
> is *)
> (* already declared *)
> DIM is_variable_is_long_to_distinguish_fromB:STRING
> DIM is_variable_is_long_to_distinguish_fromA:STRING
> (* DIM 1llegal_starts_with_numeric:STRING *)
> *)
> DIM legalALPHA_NUMER1C:STRING
> (* DIM String$ilegal:STRING results in ERROR 33 *)
> DIM legal$:STRING
> is_variable_is_long_to_distinguish_fromB="A"
> is_variable_is_long_to_distinguish_fromA="B"
> (* 456789X123456789X123456789X123456789X = 40 Characters WOW *)
> PRINT
> PRINT is_variable_is_long_to_distinguish_fromB
> PRINT "CORRECT !!"
> PRINT is_variable_is_long_to_distinguish_fromA
> PRINT "CORRECT WOW !!"
> PRINT "DONE"
> END
>
>
> Charlie
>
> >> > Wayne
> >> >
> >> > On Fri, Jul 26, 2019, 1:00 PM <coco at jechar.ca> wrote:
> >> > > I have seen examples of variable names 10 or 11 characters long
> >> > > and of the $ being used in a
> >> > > variable name.
> >> > >
> >> > > So I know that alpha numeric and $ are legal components and at
> >> > > least 10 characters long but I cannot
> >> > > find the explicit rules so for example is underscore a legal
> >> > > variable name component, what is the
> >> > > maximum number of characters in a variable and are they all
> >> > > used or for example would
> >> > > VARIABLE1 be the same as VARIABLE2 because first eight
> >> > > characters are all the same ?
> >> > >
> >> > > Only answer what you know for sure. I could always try writing a
> >> > > bunch of test programs to
> >> > > come up with the rules experimentally but perhaps someone knows
> >> > > the exact restrictions on basic09
> >> > > variable naming ?
> >> > >
> >> > > Charles
> >> > >
> >> > > --
> >> > > Coco mailing list
> >> > > Coco at maltedmedia.com
> >> > > https://pairlist5.pair.net/mailman/listinfo/coco
> >>
> >> Cheers, Gene Heskett
> >> --
> >> "There are four boxes to be used in defense of liberty:
> >> soap, ballot, jury, and ammo. Please use in that order."
> >> -Ed Howdershelt (Author)
> >> If we desire respect for the law, we must first make the law
> >> respectable. - Louis D. Brandeis
> >> Genes Web page <http://geneslinuxbox.net:6309/gene>
> >
> >
> > Cheers, Gene Heskett
> > --
> > "There are four boxes to be used in defense of liberty:
> > soap, ballot, jury, and ammo. Please use in that order."
> > -Ed Howdershelt (Author)
> > If we desire respect for the law, we must first make the law
> > respectable.
> > - Louis D. Brandeis
> > Genes Web page <http://geneslinuxbox.net:6309/gene>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>
More information about the Coco
mailing list