• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Choosing variable names
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Choosing variable names


  • Subject: Re: Choosing variable names
  • From: John Delacour <email@hidden>
  • Date: Thu, 17 Apr 2003 13:51:15 +0100
  • Mac-eudora-version: 6.0a15

At 1:16 pm +0100 17/4/03, Mr Tea wrote:

Although I intensely dislike the 'words_joined_by_underscores' style used in
many of Apple's sample scripts,

me too in principle

I was interested to note that a 'single word
followed by underscore' variable-naming style has been popping up in Mr
Delacour's posts of late. Interesting. Is this a new thing you're trying,
John? And why after rather than before the word?

Cut the formality Mr. Orange Pekoe! :-)

Yes, it's a new thing I'm trying, and I'm not sure I'll stick with it. At the moment I am using it (all lower case + underline) for ALL variables containing more than 2 characters.

I think the best thing I've come up with is pPathname, fFile, sString etc. because a) no shift key is required b) they are visually striking and immediately distinguishable from pathname, file, string etc. I will probably revert to this.

For handlers I usually adopt the Frontier style, getSpecialFolder(...) without using any underlines.

I use s for strings, f for files, ls for lists, r (or reco) for records, etc. but otherwise use meaningful names. I've recently started using fU for UNIX pathnames. f is always a colonic path.

Although using variables with names like theFile, theName, theBounds seems practical and transparent at first glance, I have often unwittingly typed a space between the two parts of the variable name from sheer force of habit. theResult is usually a script that compiles but does not run (and a lot of chasing around to find out what the problem is before I realise the mistake).

The same goes for the use of my

JD
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Choosing variable names [was - Re: Read file bug?] (From: Mr Tea <email@hidden>)

  • Prev by Date: OT - Happy Birthday Bill!
  • Next by Date: Re: Using tell application "name" where the name comes from GUI Script...
  • Previous by thread: Choosing variable names [was - Re: Read file bug?]
  • Next by thread: Re: Read file bug?
  • Index(es):
    • Date
    • Thread