Re: wishlist : structures

new topic     » goto parent     » topic index » view thread      » older message » newer message

Koda,

  Alternately you could simply replace the struc name dot with an
underscore:

for

  my.width=145
  my.height=233

>   -- was:
>   sequence my
>   constant my_WIDTH=1, my_HEIGHT=2
>   my={0,0}
>   my[my_WIDTH]=145
>   my[my_HEIGHT]=233

becomes:

   sequence my
   constant my_width=1, my_height=2
   my={0,0}
   my[my_width]=145
   my[my_height]=233

note:
   my.width=145   =>   my[my_width]=145
and
   my.height=233   =>   my[my_height]=233

This makes the program self documenting and almost as clean
as a C program file.  You shouldnt have to look anything up.

The only difference now is that you must declare a sequence
and name that sequence as well as the element, as well
as initialize it first with a zero for every element you
wish to use later as an atom or as a sequence.

Of course if you have more then one struc of the same type you'll have
to go to a second class name:

  my[my_driveway_width]=145
  my[my_sidewalk_width]=36

By looking at the statement, you always know what struc your talking
about as well as what element, and the elements are fairly easy to
remember because they are the simple name of whatever real life
variable they represent (sidewalk_width) preceded by the struc name (my)
followed by an underscore (_).

I've done this a lot because it makes the program understandable
without having to look all kinds of things up first in rem notes.
If you have a really really long list of strucs and element names,
if helps to keep a list open in notepad or whatever listing
those names and what they are for.

Koda wrote:
>>
That would work also, but it slows down programming, because you have to
type those long words, and search them up if you don't rememeber them. So I
rather write numbers and look in comments......
<<

Good luck with it.

--Al

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu