Re: Variable and function name space
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