Restricted Words in SenseTalk

The SenseTalk language includes more than 800 words that have special meaning in one context or another. A few of these words are reserved exclusively for their special meaning, however. The rest can also be used as the names of variables or for your own commands and functions.

Care has been taken to ensure that the number of restricted words is as small as possible, to give you the maximum freedom to use names that are meaningful in your scripts. In order for the SenseTalk engine to properly understand your script, there are some words whose use must be confined to their special meaning only. Attempting to use one of these restricted words in a way that is not allowed results in a syntax error.

Restricted Command and Function Names

The following words cannot be used as command or function names:

catch

constant

do

else

end

exit

function

getProp

global

if

local

next

on

pass

properties

repeat

return

send

setProp

the

then

to

try

universal

Restricted Variable Names

The following words cannot be used as variable (container) names:

down

else

empty

end

false

field

fld

global

if

repeat

return

target

then

true

universal

up

Predefined Variables

A number of other words have predefined values, and should generally be used as variables only in situations where their standard meanings are not required. To avoid confusion, it is best to avoid using these words as variable names, but their use is not prohibited, and in some cases it might be useful to store different values in them. Predefined variables are described in detail in Values. Here are some that should probably be avoided as variable names:

  • Alternative boolean values: yes, no, on, off
  • Special characters: colon, comma, cr, creturn, lf, linefeed, crlf, formfeed, newline, quote, space, tab, slash, backslash, null
  • Numbers by name: pi, zero, one, two, three, . . .
  • The current date and time: today, now, date, time

In addition, the host application and any loaded external modules might define other predefined variables.

Unquoted Literals

All other words that are allowed as variable names (i.e., not in the restricted list given above, or having a predefined special value) evaluate to their name until something else is stored in them. In other words, they can be used as unquoted literals. As soon as such a name is used as a variable, its value is treated as empty. Unquoted literals are always capitalized according to their first use in the handler. Subsequent uses of the same name (varying only by case) in the same handler are treated the same as the first occurrence (as illustrated by the first 3 lines of the examples below).

Note: If the strictVariables global property is set to true, it prevents the use of uninitialized variables as unquoted literals.

Examples:

put BIG -- "BIG"

put little -- "little"

put big && LITTLE -- "BIG little"

set the strictVariables to true -- prevent use of unquoted literals

put big -- this will throw an exception

 

This topic was last updated on August 19, 2021, at 03:30:51 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2022 Eggplant