Previous Page Contents

Pref::warnLexProcEnv -- warnings about usage of variables from lexical scope

Introduction

Pref::warnLexProcEnv() returns the current setting.

Pref::warnLexProcEnv(TRUE) switches on parser warnings about the usage of variables from the lexical scope.

Pref::warnLexProcEnv(FALSE) switches warning messages off.

Pref::warnLexProcEnv(NIL) will reset the default value, which is FALSE.

Call(s)

Pref::warnLexProcEnv()
Pref::warnLexProcEnv(TRUE)
Pref::warnLexProcEnv(FALSE)
Pref::warnLexProcEnv(NIL)

Returns

the previously defined value; TRUE or FALSE

Side Effects

Allows or suppresses warning messages of the parser.

Further Documentation

changes

Related Functions

Pref::warnChanges, Pref::warnDeadProcEnv, proc

Details

Example 1

Here you can see a procedure which computes the square of its argument in a very complicated way. The inner procedure g makes use of the variable x of procedure f, thus a warning is given. But this is no problem, since g does not escape its scope. See Pref::warnDeadProcEnv about problems of procedure leaving its scope.

>> Pref::warnLexProcEnv(TRUE): 
   f := proc(x) local g; begin g := y -> x*y; g(x) end:
   f(5)
      Warning: Procedure '->' is referring outer lexical closure \
       [col 42]
      
                                    25

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000