• 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: Variable and function name space
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Variable and function name space


  • Subject: Re: Variable and function name space
  • From: Thomas Fischer <email@hidden>
  • Date: Tue, 31 May 2011 12:52:55 +0200

Hi Adrian,

that is probably a bug, AppleScript should distinguish between variables and functions by taking the "()" into account.

> Is it normal for a programming language to have variables and functions in the same name space?

I suppose it depends on how you define namespace. Perl uses typeglobs to hold symbol arrays, where one name references all possible variables, functions or handles, depending on the respective prefix ($,@,%,&,*). I don't know if these count as different namespaces.

Thomas


> There were some hard to catch bugs for me over the years that involved a variable and a function having the same name. To never run into this problem again I decided to put underscores before variable names. This also allows me to use names such as _class or _date which might otherwise be reserved keywords.
>
>
>
> set doINeedToPutUnderscoresBeforeVariableNames to "Maybe"
>
> try
> 	return doINeedToPutUnderscoresBeforeVariableNames()
> on error
> 	return "You should start variable names with an underscore."
> end try
>
>
> on doINeedToPutUnderscoresBeforeVariableNames()
>
> 	return "You don’t need to put underscore before variable names."
>
> end doINeedToPutUnderscoresBeforeVariableNames
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Variable and function name space (From: Adrian Nier <email@hidden>)

  • Prev by Date: Re: Filmier to ical
  • Next by Date: Re: Variable and function name space
  • Previous by thread: Variable and function name space
  • Next by thread: Re: Variable and function name space
  • Index(es):
    • Date
    • Thread