Declarations
Variable names and other user-defined symbols are known as identifiers, which may be of any
length, with upper and lower case being distinct. Identifiers must start with a letter and then be
followed by letters, digits or underscores. All unicode characters may be used, as long as your
editor saves the source files as utf-8 - note however that all non-ascii characters are treated as
letters, including a few that might look rather similar to operators, and even some numbers.
The following reserved words have special meaning in Phix and may not be used as identifiers:
Since version 0.8.0 the following are also treated as reserved words:
Note however that none of the following (and then some) are technically reserved words, although the editor colours them differently, to give you a hint that it could be rather foolish to use them as identifiers:
The following reserved words have special meaning in Phix and may not be used as identifiers:
and or not xor
break continue exit fallthru
case default format fallthrough
constant enum abstract iff
try catch dynamic iif
class struct extends
do while until switch
for by to end
if then elsif else
true false null goto
function procedure type return
ifdef elsifdef elsedef private
forward global export public
include with without
Edita displays these words in teal (easily changed in Options/Colours).Since version 0.8.0 the following are also treated as reserved words:
abort atom number bool
close compare int integer
seq sequence string object
delete equal floor flush
log peek poke power
prepend profile trace seek
sin sleep version where
Identifiers can be used in naming the following:
Note however that none of the following (and then some) are technically reserved words, although the editor colours them differently, to give you a hint that it could be rather foolish to use them as identifiers:
apply assert boolean call
choose crash date elapsed
factors filter find free
head join largest listen
lower map match max
min mod pad print
product proper progress repeat
reverse shorten shuffle sign
smallest sort split substitute
sum system tail trim
union unique upper value
Also, do yourself a favour and avoid these JavaScript reserved words, should you plan on ever
using pwa/p2js to run stuff in a browser:
arguments await const debugger
delete eval final finally
implements import in instanceof
interface let native new
package protected super synchronized
this throws transient typeof
var void volatile yield
The transpiler issues a fatal error should you try to use any of those. A few more have also
slipped in that trigger strictly unnecessary errors, some of which I might be able to stop
the transpiler from issuing, and some of which will have to be added to the above table.
(I basically used the same mechanism for syntax colouring and reserved words, oops.)