IntegerP and StringP are listed in Director Help - just look in the Lingo
dictionary.
Lingo is what is known as a "loosely-typed" language, meaning that a
variable can be one of many types (integer, string, etc.) and, in fact, can
change from assignment to assignment.
In general, there are two ways of finding out what type a variable is at
any given moment.
The lesser used, but more inclusive, 'ilk' function, returns the type of
any variable:
put ilk(myVar)
-- #Integer
put ilk(myVar)
-- #Member
put ilk(myVar)
-- #Proplist
So, as you can see, not only does it "work", but it gives specifically the
variable type, including members and property lists. In fact, this is
really the only way you can see if a variable is a member or specifically a
property list.
In addition to 'ilk' there are a variety of helper functions. These are
IntegerP(), StringP(), VoidP(), ObjectP(), ListP(), and perhaps a few more
I'm forgetting. These tell you if, or if not, a variable is of the type
requested, as in:
if listP(myVar) then
-- Now you can do list functions, you know it's a list
numItems =count(myVar)
end if
or...
myFileObj =new(xtra "fileio")
if not objectP(myFileObj) then
alert "Could not instantiate FileIO!"
return
end if
However, there are a wide variety of types in Lingo, and so only the more
common ones are implemented in an 'xxxxP()' function. Personally I think
the selection is fine, with the exception that I have often wanted a
memberP() function. Other than that, I'm happy.
If you're interested about the 'P', it derives from the LISP language,
where functions ending in P were tests ('P' meaning 'predicate', if I
recall), so xxxP(var) was a test to see if the var was of type xxx. LISP
is one of the influences on Lingo (along with SmallTalk and BASIC) and so
when integer test functions and the like were implemented in Lingo, they
were given names like 'IntegerP()'.
Hope this answers your question.
Tab Julius
Penworks Corporation
Software Engineering + Software Architecture
www.penworks.com
At 09:35 AM 1/3/02 -0500, Carol Mahaffy wrote:
>hi list --
>how can i find reference to this way of refering to a value? It seems like a
>really clean way of doing it but haven't run across it in the books... just
>on this list. thanks
>-- carol
[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!]