Previous Page Next Page Contents

prog::isGlobal -- information about reserved identifiers

Introduction

prog::isGlobal(ident) determines whether the identifier ident is used by the system.

Call(s)

prog::isGlobal(ident)

Parameters

ident - identifier to check

Returns

prog::isGlobal return TRUE, if the given identifier is used by the system, otherwise FALSE.

Related Functions

prog::check, anames, type, domtype

Details

Example 1

Assume you would like to use some identifiers as options for a new function you wrote. In this example, we will check the elements of the list [All, Beta, Circle, D, eval, First] for suitability. (Note that eval would not be a good choice, even if it was not a system function, because options should start with a capital letter.)

We define a test function which is mapped to the list and returns FAIL, if the tested object is not an identifier, TRUE, if the identifier is used by the system and FALSE otherwise:

>> reset():
   LIST:= [All, Beta, Circle, D, eval, First]:
   map(LIST, X -> if domtype(X) <> DOM_IDENT then
                    X = FAIL
                  else
                    X = prog::isGlobal(X)
                  end_if)
      [All = TRUE, Beta = FALSE, Circle = FALSE, D = FAIL,
      
         eval = FAIL, First = TRUE]

The identifiers All and First can be used as options because they have already been protected by the system (actually, they are already used as options, which makes them a good choice), the identifiers Beta and Circle are free and one must only take care that they have no value if they will be used as options--they should be protected first. D and eval have values and cannot be used as options.

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000