On Sun, 29 Jun 2003 12:48:15 -0300, "Diego Landro"
<[EMAIL PROTECTED]> wrote:

> In a director project i recentely been involved into, i found
> that what to me appear as variables are in green. ie name and i
> canĄt relate the name to any fnction lingo has for name, so i
> wonder if i decide to name a variable "name" it will appear in
> green instead of the more familiar black? DoenĄt lingo hace
> reserved words like many other languages? is just this or my
> problem is completely different? If more info is require i can
> post the code so you can figure it out better. Maybe is just a
> function i skipped while searching the lingo dictionary but i
> donĄt think so. Thanks guys

'name' is a property of the member object (and possibly certain others
which elude me at the moment).

The syntax colouring in Director is fairly unsophisticated, and does not
appear to have any grammatical awareness. 

Essentially, they just have a look-up table with words in three or four
different categories and a colour to go with them. 

This means that if one of your own variables or symbols appears in green,
then that word is used 'somewhere' for 'something' in Lingo, but not that
it is a 'reserved' word, although if it appears in blue you should be
careful. (Don't use the word 'on' for example).

Another example is this well-formed and fully-functional code:

on test  
  member = member(1)
  return member.name
end

Now, 'member' is usually parsed in a very particular way, but here I'm
using it as a variable name. Nothing breaks and it all works the same as
if I had used any other variable name, but there is certainly room for
confusion later on as complexity increases.

So, for much of the time you can freely use the 'green' words for your own
names, but in some very special cases this *will* cause the lingo parser
to get confused (not to mention the programmer) because it might expect
the wrong thing, which can be a nuisance to debug. I can't think of an
example off-hand, but I have certainly experienced this. 

Yes, I can think of one: If you have a behavior with a property called
'member', and attach that behavior to sprite N, then sprite(N).member may
or may not give you the expected result. (It gives you the *sprite*
member, not the behavior property).

To be absolutely safe, use a slightly different spelling. I usually add,
tweak or remove some vowels, replace 's' with 'z' and various other things
which keep the word phonetically identical to the human reader. For
example 'name' could be 'nayme' or 'nam' or even 'nom' (if you have any
French). 

It's certainly an advantage to be a non-english speaker because you can
use other language words for you own variable and handler names, although
it's best to stay with the roman alphabet if you can help it.

Brennan
[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email [EMAIL 
PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping 
with programming Lingo.  Thanks!]

Reply via email to