scripting style issue

Jan Schenkel janschenkel at yahoo.com
Wed Jan 15 02:08:01 EST 2003


Sarah beat me to it. So I second her 'Traling A'
proposition as it doesn't interfere with the principle
of a single chracter at the front.

Another approach I've used in the past was to keep the
other variable names singular and make array variable
names plural ; but that doesn't feel natural to XTalk,
as it can bite chunks out of strings so easily that I
wouldn't bother to use an array most of the time.

Jan Schenkel.

--- Sarah <sarahr at genesearch.com.au> wrote:
> Hi Richard,
> 
> I have read your script style guide and while I
> don't adhere to it 
> strictly, it has influenced my variable naming and
> script layout. I 
> agree that arrays need their own nomenclature as
> unlike all other types 
> of xTalk variables, arrays are distinctively
> different and cannot be 
> handled in the same way as a string or numeric
> variable.
> 
> Like you, I have tended to add the word "Array" to
> the end of array 
> variables, but I haven't used arrays very much yet,
> so it hasn't proved 
> too cumbersome. As my use of arrays increases, I
> expect that will 
> become tedious, so I would agree with you about a
> shorter way of 
> indicating but I'm not sure that the use of two
> identifying characters 
> at the start of the variable name makes for easy
> readability. What 
> about an upper case A at the end?
> e.g.
> 	gMyVariable	- normal global variable
> 	gMyVariableA	- global array
> To my eye, that stands out much more on a quick
> glance, than 
> gaMyVariable
> 
> So in answer to your questions:
> 1. yes - add something about arrays
> 2. gMyVariableA
> 3. no :-)
> 
> Cheers,
> Sarah
> 
> 
> On Tuesday, January 14, 2003, at 07:18  pm, Richard
> Gaskin wrote:
> 
> >
> > As documented in the Script Style Guide at
> >
>
<http://www.fourthworld.com/embassy/articles/scriptstyle.html>,
> I'm 
> > fairly
> > OCD when it comes to variable names, having
> adopted the sort of
> > Hungarian-notation-lite that makes dissecting code
> just a little 
> > easier.
> >
> > There's an item not addressed in that document
> that's becoming an
> > ever-bigger part of my scripting: arrays.
> >
> > It's useful to denote arrays distinctly because
> they require different
> > syntax from other variable types.  For example,
> you can get the value 
> > of an
> > arrany element, but you can't get a displayable
> string from the array
> > itself.
> >
> > For a long time I just added the word "Array" to
> the end of a variable 
> > name
> > as a reminder, like "gMyOpenWindowsArray".  As I
> use arrays more and 
> > more, I
> > simply don't want to type that much, any more than
> I would type
> > "globalMyOpenWindows"
> >
> > In recent weeks I've started adding an "a" after
> the type specifier as 
> > a
> > shorter, arguably clearer, notation:
> >
> >   string form:  gMyOpenWindows
> >   array form:   gaMyOpenWindows
> >
> > With script-locals being:
> >
> >   string form:  sMyOpenWindows
> >   array form:   saMyOpenWindows
> >
> > Parameters:
> >
> >   string form:  pMyOpenWindows
> >   array form:   paMyOpenWindows
> >
> > ...etc.
> >
> > While I've enjoyed this in my own scripting, I
> recognize there's a 
> > fine line
> > between adding specificity and making things
> cumbersome.
> >
> > So three questions:
> >
> > 1. Does this convention seem useful? Specifically,
> should I bother 
> > adding it
> > to the Script Style Guide?
> >
> > 2. How do you denote arrays?
> >
> > 3. Is this boring?
> >
> > -- 
> >  Richard Gaskin
> >  Fourth World Media Corporation
> >  Developer of WebMerge 2.1: Publish any database
> on any site
> > 
>
___________________________________________________________
> >  Ambassador at FourthWorld.com      
> http://www.FourthWorld.com
> >  Tel: 323-225-3717                       AIM:
> FourthWorldInc
> >
> > _______________________________________________
> > use-revolution mailing list
> > use-revolution at lists.runrev.com
> >
>
http://lists.runrev.com/mailman/listinfo/use-revolution
> >
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
>
http://lists.runrev.com/mailman/listinfo/use-revolution


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the use-livecode mailing list