Pref::warnLexProcEnv
--
warnings about usage of variables from lexical scopePref::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
.
Pref::warnLexProcEnv()
Pref::warnLexProcEnv(TRUE)
Pref::warnLexProcEnv(FALSE)
Pref::warnLexProcEnv(NIL)
the previously defined value; TRUE
or FALSE
Allows or suppresses warning messages of the parser.
changes
Pref::warnChanges
, Pref::warnDeadProcEnv
,
proc
Pref::warnLexProcEnv
is enabled the parser warns if
a procedure defined in the lexical scope of another procedure uses
variables from its lexical scope.Pref::warnDeadProcEnv
switches
on warnings about the critical usage of the lexical scope.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