Protected Symbols

AutoCAD AutoLISP & Visual LISP

 
Protected Symbols
 
 
 

You may be warned if you attempt to change the value of some symbols used by the AutoLISP language. These symbols are known as protected symbols, and include items such as arithmetic operators (for example, +, -) and the values T and nil. You can use the Visual LISP Symbol Service feature to determine if a symbol is protected.

When you first start AutoCAD, protected symbols receive no special protection. If you set a protected symbol at the AutoCAD Command prompt, you receive no indication that the symbol has any special status. However, once you start Visual LISP, this changes. From the moment you start Visual LISP until the end of your AutoCAD session, AutoLISP intercepts any attempt to modify a protected symbol. Processing of protected symbols depends on the status of a Visual LISP environment option. You can specify one of the following options:

  • Transparent Protected symbols are treated like any other symbol.
  • Print message AutoLISP issues a warning message when you modify a protected symbol but carries out the modification. For example, the following demonstrates what happens when you modify the symbol T:

    Command: (setq t "look out")

    ; *U* WARNING: assignment to protected symbol: T <- "look out"

    "look out"

  • Prompt to enter break loop This is the default option, resulting in AutoLISP displaying the following message box when you attempt to modify a protected symbol:

    If you choose No, the symbol's value is modified, and processing continues normally. If you choose Yes, processing is interrupted, and you enter a Visual LISP break loop. Control switches to the Visual LISP Console window. To set the symbol and continue processing, press the Continue button on the Visual LISP toolbar; to abort modification, press Reset.

  • Error This option prohibits modification of protected symbols. Any attempt to modify a protected symbol results in an error message.

To specify how AutoLISP responds to attempts to modify protected symbols, choose Tools Environment Options General Options from the Visual LISP menu.